Package org.apache.druid.segment
Class CursorBuildSpec
- java.lang.Object
-
- org.apache.druid.segment.CursorBuildSpec
-
public class CursorBuildSpec extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCursorBuildSpec.CursorBuildSpecBuilder
-
Field Summary
Fields Modifier and Type Field Description static CursorBuildSpecFULL_SCAN
-
Constructor Summary
Constructors Constructor Description CursorBuildSpec(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CursorBuildSpec.CursorBuildSpecBuilderbuilder()static CursorBuildSpec.CursorBuildSpecBuilderbuilder(CursorBuildSpec spec)List<AggregatorFactory>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.FiltergetFilter()Filterto supply to theCursorHolder.List<String>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.org.joda.time.IntervalgetInterval()Intervalfilter to supply to theCursorHolder.Set<String>getPhysicalColumns()Set of physical columns required from a cursor.List<OrderBy>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.QueryContextgetQueryContext()QueryContextfor theCursorHolderto provide a mechanism to push various data intoCursorandVectorCursorsuch asQueryContexts.VECTORIZE_KEYandQueryContexts.VECTOR_SIZE_KEYQueryMetrics<?>getQueryMetrics()VirtualColumnsgetVirtualColumns()AnyVirtualColumnswhich are used by a query engine to assist in determining ifCursorHolder.canVectorize()booleanisAggregate()Returns true ifgetGroupingColumns()is not null or empty and/orgetAggregators()is not null or empty.booleanisCompatibleOrdering(List<OrderBy> ordering)Returns true if the supplied ordering matchesgetPreferredOrdering(), meaning that the supplied ordering has everything which is in the preferred ordering in the same direction and order.
-
-
-
Field Detail
-
FULL_SCAN
public static final CursorBuildSpec FULL_SCAN
-
-
Constructor Detail
-
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 Detail
-
builder
public static CursorBuildSpec.CursorBuildSpecBuilder builder()
-
builder
public static CursorBuildSpec.CursorBuildSpecBuilder builder(CursorBuildSpec spec)
-
getFilter
@Nullable public Filter 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
@Nullable public Set<String> getPhysicalColumns()
Set of physical columns required from a cursor. If null, andgroupingColumnsis null or empty andaggregatorsis null or empty, then aCursorHoldermust assume that ALL columns are required
-
getVirtualColumns
public VirtualColumns getVirtualColumns()
AnyVirtualColumnswhich are used by a query engine to assist in determining ifCursorHolder.canVectorize()
-
getGroupingColumns
@Nullable public List<String> 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
@Nullable public List<AggregatorFactory> 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
public List<OrderBy> 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
public QueryContext getQueryContext()
QueryContextfor theCursorHolderto provide a mechanism to push various data intoCursorandVectorCursorsuch asQueryContexts.VECTORIZE_KEYandQueryContexts.VECTOR_SIZE_KEY
-
getQueryMetrics
@Nullable public QueryMetrics<?> 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
public boolean isCompatibleOrdering(List<OrderBy> ordering)
Returns true if the supplied ordering matchesgetPreferredOrdering(), meaning that the supplied ordering has everything which is in the preferred ordering in the same direction and order. The supplied ordering may have additional columns beyond the preferred ordering and still satisify this method.
-
-