Module org.elasticsearch.compute
Class HashAggregationOperator
java.lang.Object
org.elasticsearch.compute.operator.HashAggregationOperator
- All Implemented Interfaces:
Closeable,AutoCloseable,Operator,org.elasticsearch.core.Releasable
- Direct Known Subclasses:
TimeSeriesAggregationOperator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder forHashAggregationOperator.static classstatic classNested classes/interfaces inherited from interface org.elasticsearch.compute.operator.Operator
Operator.OperatorFactory -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<GroupingAggregator.Factory> protected final AggregatorModeprotected final List<GroupingAggregator> protected BlockHashstatic final intstatic final doubleprotected final DriverContextprotected longprotected longTotal nanos for emitting the outputprotected org.elasticsearch.core.ReleasableIterator<Page> protected final intprotected final doubleprotected longFields inherited from interface org.elasticsearch.compute.operator.Operator
MIN_TARGET_PAGE_SIZE, NOT_BLOCKED, TARGET_PAGE_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionHashAggregationOperator(AggregatorMode aggregatorMode, List<GroupingAggregator.Factory> aggregatorFactories, Supplier<BlockHash> blockHashSupplier, int partialEmitKeysThreshold, double partialEmitUniquenessThreshold, int maxPageSize, DriverContext driverContext) Build the operator. -
Method Summary
Modifier and TypeMethodDescriptionvoidadds an input page to the operator.booleanReturns true if the operator can produce more output pages without requiring additional input pages.protected static voidcheckState(boolean condition, String msg) voidclose()notifies the operator that it won't be used anymore (i.e.protected IntVectorcustomizeSelected(GroupingAggregator aggregator, IntVector selected) Customize theselectedgroupIds that are sent to the agg'sGroupingAggregatorFunction.prepareEvaluateIntermediate(org.elasticsearch.compute.data.IntVector, org.elasticsearch.compute.aggregation.GroupingAggregatorEvaluationContext)andGroupingAggregatorFunction.prepareEvaluateFinal(org.elasticsearch.compute.data.IntVector, org.elasticsearch.compute.aggregation.GroupingAggregatorEvaluationContext).protected voidemit()protected GroupingAggregatorEvaluationContextevaluationContext(BlockHash blockHash) voidfinish()notifies the operator that it won't receive any more input pagesreturns non-null if output page available.booleanwhether the operator has finished processing all input pages and made the corresponding output pages availablebooleanwhether the given operator can accept more input pagesprotected booleanstatus()The status of the operator.toString()
-
Field Details
-
DEFAULT_PARTIAL_EMIT_KEYS_THRESHOLD
public static final int DEFAULT_PARTIAL_EMIT_KEYS_THRESHOLD- See Also:
-
DEFAULT_PARTIAL_EMIT_UNIQUENESS_THRESHOLD
public static final double DEFAULT_PARTIAL_EMIT_UNIQUENESS_THRESHOLD- See Also:
-
blockHashSupplier
-
aggregatorMode
-
aggregatorFactories
-
aggregators
-
partialEmitKeysThreshold
protected final int partialEmitKeysThreshold -
partialEmitUniquenessThreshold
protected final double partialEmitUniquenessThreshold -
driverContext
-
blockHash
-
output
-
emitNanos
protected long emitNanosTotal nanos for emitting the output -
emitCount
protected long emitCount -
rowsAddedInCurrentBatch
protected long rowsAddedInCurrentBatch
-
-
Constructor Details
-
HashAggregationOperator
public HashAggregationOperator(AggregatorMode aggregatorMode, List<GroupingAggregator.Factory> aggregatorFactories, Supplier<BlockHash> blockHashSupplier, int partialEmitKeysThreshold, double partialEmitUniquenessThreshold, int maxPageSize, DriverContext driverContext) Build the operator. Instead of calling this directly, build theHashAggregationOperator.Builder, then theHashAggregationOperator.Builder.build()thenHashAggregationOperator.Factory.get(org.elasticsearch.compute.operator.DriverContext).
-
-
Method Details
-
needsInput
public boolean needsInput()Description copied from interface:Operatorwhether the given operator can accept more input pages- Specified by:
needsInputin interfaceOperator
-
addInput
Description copied from interface:Operatoradds an input page to the operator. only called when needsInput() == true and isFinished() == false -
getOutput
Description copied from interface:Operatorreturns non-null if output page available. Only called when isFinished() == false -
finish
public void finish()Description copied from interface:Operatornotifies the operator that it won't receive any more input pages -
emit
protected void emit() -
customizeSelected
Customize theselectedgroupIds that are sent to the agg'sGroupingAggregatorFunction.prepareEvaluateIntermediate(org.elasticsearch.compute.data.IntVector, org.elasticsearch.compute.aggregation.GroupingAggregatorEvaluationContext)andGroupingAggregatorFunction.prepareEvaluateFinal(org.elasticsearch.compute.data.IntVector, org.elasticsearch.compute.aggregation.GroupingAggregatorEvaluationContext). TSDB uses this to do less work later on. -
shouldEmitPartialResultsPeriodically
protected boolean shouldEmitPartialResultsPeriodically() -
evaluationContext
-
isFinished
public boolean isFinished()Description copied from interface:Operatorwhether the operator has finished processing all input pages and made the corresponding output pages available- Specified by:
isFinishedin interfaceOperator
-
canProduceMoreDataWithoutExtraInput
public boolean canProduceMoreDataWithoutExtraInput()Description copied from interface:OperatorReturns true if the operator can produce more output pages without requiring additional input pages. This is useful for operators that buffer data or have internal state that can produce multiple output pages.Operators that do not buffer data should return
false- they cannot produce pages out of thin air. Examples of operators that may returntrue:- Operators with internal buffers (e.g.,
AsyncOperatorwith pending results) - Operators processing a single input page into multiple output pages
- Aggregation operators that buffer partial results
- Specified by:
canProduceMoreDataWithoutExtraInputin interfaceOperator- Returns:
trueif the operator has buffered data that can produce output,falseotherwise
- Operators with internal buffers (e.g.,
-
close
public void close()Description copied from interface:Operatornotifies the operator that it won't be used anymore (i.e. none of the other methods called), and its resources can be cleaned up -
status
Description copied from interface:OperatorThe status of the operator. -
checkState
-
toString
-