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 class
CursorBuildSpec.CursorBuildSpecBuilder
-
Field Summary
Fields Modifier and Type Field Description static CursorBuildSpec
FULL_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.CursorBuildSpecBuilder
builder()
static CursorBuildSpec.CursorBuildSpecBuilder
builder(CursorBuildSpec spec)
List<AggregatorFactory>
getAggregators()
AnyAggregatorFactory
which will be used by a query engine for theCursorHolder
, useful to assist in determining ifCursorHolder.canVectorize()
, as well as specializing theCursor
orVectorCursor
if any pre-aggregated data is available.Filter
getFilter()
Filter
to supply to theCursorHolder
.List<String>
getGroupingColumns()
Any columns which will be used for grouping by a query engine for theCursorHolder
, useful for specializing theCursor
orVectorCursor
if any pre-aggregated data is available.org.joda.time.Interval
getInterval()
Interval
filter to supply to theCursorHolder
.Set<String>
getPhysicalColumns()
Set of physical columns required from a cursor.List<OrderBy>
getPreferredOrdering()
List of allOrderBy
columns which a query engine will use to sort its results to supply to theCursorHolder
, which can allow optimization of the providedCursor
orVectorCursor
if data matching the preferred ordering is available.QueryContext
getQueryContext()
QueryContext
for theCursorHolder
to provide a mechanism to push various data intoCursor
andVectorCursor
such asQueryContexts.VECTORIZE_KEY
andQueryContexts.VECTOR_SIZE_KEY
QueryMetrics<?>
getQueryMetrics()
VirtualColumns
getVirtualColumns()
AnyVirtualColumns
which are used by a query engine to assist in determining ifCursorHolder.canVectorize()
boolean
isAggregate()
Returns true ifgetGroupingColumns()
is not null or empty and/orgetAggregators()
is not null or empty.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.
-
-
-
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()
Filter
to supply to theCursorHolder
. Only rows which match will be available through the selectors created from theCursor
orVectorCursor
-
getInterval
public org.joda.time.Interval getInterval()
Interval
filter to supply to theCursorHolder
. Only rows whose timestamps fall within this range will be available through the selectors created from theCursor
orVectorCursor
-
getPhysicalColumns
@Nullable public Set<String> getPhysicalColumns()
Set of physical columns required from a cursor. If null, andgroupingColumns
is null or empty andaggregators
is null or empty, then aCursorHolder
must assume that ALL columns are required
-
getVirtualColumns
public VirtualColumns getVirtualColumns()
AnyVirtualColumns
which 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 theCursor
orVectorCursor
if any pre-aggregated data is available.
-
getAggregators
@Nullable public List<AggregatorFactory> getAggregators()
AnyAggregatorFactory
which will be used by a query engine for theCursorHolder
, useful to assist in determining ifCursorHolder.canVectorize()
, as well as specializing theCursor
orVectorCursor
if any pre-aggregated data is available.
-
getPreferredOrdering
public List<OrderBy> getPreferredOrdering()
List of allOrderBy
columns which a query engine will use to sort its results to supply to theCursorHolder
, which can allow optimization of the providedCursor
orVectorCursor
if 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()
QueryContext
for theCursorHolder
to provide a mechanism to push various data intoCursor
andVectorCursor
such asQueryContexts.VECTORIZE_KEY
andQueryContexts.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 aCursorFactory
should attempt to produce aCursorHolder
that 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.
-
-