Package org.apache.druid.segment
Class CursorBuildSpec
java.lang.Object
org.apache.druid.segment.CursorBuildSpec
Defines the plan for how the reader will scan, filter, transform, group and aggregate, and or order the data from a
CursorFactory so that an appropriate CursorHolder can be constructed. The CursorBuildSpec
includes physical and virtual columns will be read from the data, a Filter so that the Cursor and
VectorCursor only provide matching rows, and details on how the scanned, transformed, and filtered data will
be grouped, aggegated, and ordered if applicable to allow CursorHolder construction to provide optimized
Cursor or VectorCursor such as providing cursors for pre-aggregated data with
Projections.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCursorBuildSpec(Filter filter, org.joda.time.Interval interval, Set<String> physicalColumns, VirtualColumns virtualColumns, List<String> groupingColumns, List<AggregatorFactory> aggregators, List<OrderBy> preferredOrdering, QueryContext queryContext, QueryMetrics<?> queryMetrics) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()builder(CursorBuildSpec spec) booleanAnyAggregatorFactorywhich will be used by a query engine for theCursorHolder, useful to assist in determining ifCursorHolder.canVectorize(), as well as specializing theCursororVectorCursorif any pre-aggregated data is available.Filterto supply to theCursorHolder.Any columns which will be used for grouping by a query engine for theCursorHolder, useful for specializing theCursororVectorCursorif any pre-aggregated data is available.org.joda.time.IntervalIntervalfilter to supply to theCursorHolder.Set of physical columns required from a cursor.List of allOrderBycolumns which a query engine will use to sort its results to supply to theCursorHolder, which can allow optimization of the providedCursororVectorCursorif data matching the preferred ordering is available.QueryContextfor theCursorHolderto provide a mechanism to push various data intoCursorandVectorCursorsuch asQueryContexts.VECTORIZE_KEYandQueryContexts.VECTOR_SIZE_KEYQueryMetrics<?>AnyVirtualColumnswhich are used by a query engine to assist in determining ifCursorHolder.canVectorize()inthashCode()booleanReturns true ifgetGroupingColumns()is not null or empty and/orgetAggregators()is not null or empty.booleanisCompatibleOrdering(List<OrderBy> ordering) Returns true if the given ordering is compatible withgetPreferredOrdering().toString()
-
Field Details
-
FULL_SCAN
-
-
Constructor Details
-
CursorBuildSpec
public CursorBuildSpec(@Nullable Filter filter, org.joda.time.Interval interval, @Nullable Set<String> physicalColumns, VirtualColumns virtualColumns, @Nullable List<String> groupingColumns, @Nullable List<AggregatorFactory> aggregators, List<OrderBy> preferredOrdering, QueryContext queryContext, @Nullable QueryMetrics<?> queryMetrics)
-
-
Method Details
-
builder
-
builder
-
getFilter
Filterto supply to theCursorHolder. Only rows which match will be available through the selectors created from theCursororVectorCursor -
getInterval
public org.joda.time.Interval getInterval()Intervalfilter to supply to theCursorHolder. Only rows whose timestamps fall within this range will be available through the selectors created from theCursororVectorCursor -
getPhysicalColumns
Set of physical columns required from a cursor. If null, then aCursorHoldermust assume that ALL columns are required. -
getVirtualColumns
AnyVirtualColumnswhich are used by a query engine to assist in determining ifCursorHolder.canVectorize() -
getGroupingColumns
Any columns which will be used for grouping by a query engine for theCursorHolder, useful for specializing theCursororVectorCursorif any pre-aggregated data is available. -
getAggregators
AnyAggregatorFactorywhich will be used by a query engine for theCursorHolder, useful to assist in determining ifCursorHolder.canVectorize(), as well as specializing theCursororVectorCursorif any pre-aggregated data is available. -
getPreferredOrdering
List of allOrderBycolumns which a query engine will use to sort its results to supply to theCursorHolder, which can allow optimization of the providedCursororVectorCursorif data matching the preferred ordering is available.If not specified, the cursor will advance in the native order of the underlying data.
-
getQueryContext
QueryContextfor theCursorHolderto provide a mechanism to push various data intoCursorandVectorCursorsuch asQueryContexts.VECTORIZE_KEYandQueryContexts.VECTOR_SIZE_KEY -
getQueryMetrics
-
isAggregate
public boolean isAggregate()Returns true ifgetGroupingColumns()is not null or empty and/orgetAggregators()is not null or empty. This method is useful for quickly checking if it is worth considering if aCursorFactoryshould attempt to produce aCursorHolderthat isCursorHolder.isPreAggregated()to satisfy the build spec. -
isCompatibleOrdering
Returns true if the given ordering is compatible withgetPreferredOrdering(). This means that, for every column in the preferred ordering, the supplied ordering must either:- use the same direction, or
- use the exact opposite direction.
The supplied ordering may also include extra columns beyond those in the preferred ordering and still satisfy this condition.
-
equals
-
hashCode
public int hashCode() -
toString
-