Interface CursorHolder
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
IncrementalIndexCursorHolder,QueryableIndexCursorHolder
Cursor and if available, VectorCursor which readers can use to scan a set of rows defined
originally from a CursorBuildSpec which describes how data is to be scanned, transformed, filter, grouped and
aggregated, and/or ordered.
If canVectorize() then asVectorCursor() will return a non-null value allowing for processing rows
in batches instead of individually.
If isPreAggregated() is true, readers which are aggregating must call
getAggregatorsForPreAggregated() to get the updated set of AggregatorFactory to correctly process
results
getOrdering() defines how the data is ordered in the Cursor or VectorCursor, allowing
readers to compare to their own desired ordering and potentially skip ordering their own results if it is
pre-ordered.
-
Method Summary
Modifier and TypeMethodDescriptionasCursor()Create aCursorfor use with non-vectorized query engines.default VectorCursorCreate aVectorCursorfor use with vectorized query engines.default booleanReturns true if thisCursorHoldersupports callingasVectorCursor().default voidclose()Release any resources acquired by cursors.default List<AggregatorFactory> Returns a set of replacementAggregatorFactoryif and only ifisPreAggregated()is true.Returns cursor ordering, which may or may not matchCursorBuildSpec.getPreferredOrdering().default OrderIfgetOrdering()starts withColumnHolder.TIME_COLUMN_NAME, returns the time ordering; otherwise returnsOrder.NONE.default booleanReturns true if theCursororVectorCursorcontains pre-aggregated columns for all grouping columns specified inCursorBuildSpec.getGroupingColumns()and allAggregatorFactoryspecified inCursorBuildSpec.getAggregators().
-
Method Details
-
asCursor
Create aCursorfor use with non-vectorized query engines. -
asVectorCursor
Create aVectorCursorfor use with vectorized query engines. -
canVectorize
default boolean canVectorize()Returns true if thisCursorHoldersupports callingasVectorCursor(). -
isPreAggregated
default boolean isPreAggregated()Returns true if theCursororVectorCursorcontains pre-aggregated columns for all grouping columns specified inCursorBuildSpec.getGroupingColumns()and allAggregatorFactoryspecified inCursorBuildSpec.getAggregators().If this method returns true,
ColumnSelectorFactoryandVectorColumnSelectorFactorycreated fromCursorandVectorCursorrespectively will provide selectors forAggregatorFactory.getName(), and engines should rewrite the query usingAggregatorFactory.getCombiningFactory(), since the values returned from these selectors will be of typeAggregatorFactory.getIntermediateType(), so the cursor becomes a "fold" operation rather than a "build" operation. -
getAggregatorsForPreAggregated
Returns a set of replacementAggregatorFactoryif and only ifisPreAggregated()is true. The query engine should replace the query aggregators with these aggregators, which are combining aggregators derived from theCursorBuildSpecpassed intoCursorFactory.makeCursorHolder(CursorBuildSpec). IfisPreAggregated()is not true, this method returns null -
getOrdering
Returns cursor ordering, which may or may not matchCursorBuildSpec.getPreferredOrdering(). If returns an empty list then the cursor has no defined ordering.Cursors associated with this holder return rows in this ordering, using the natural comparator for the column type. Includes
ColumnHolder.TIME_COLUMN_NAMEif appropriate. -
getTimeOrder
IfgetOrdering()starts withColumnHolder.TIME_COLUMN_NAME, returns the time ordering; otherwise returnsOrder.NONE. -
close
default void close()Release any resources acquired by cursors.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-