Package io.trino.operator
Class HashAggregationOperator
- java.lang.Object
-
- io.trino.operator.HashAggregationOperator
-
- All Implemented Interfaces:
Operator,AutoCloseable
public class HashAggregationOperator extends Object implements Operator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHashAggregationOperator.HashAggregationOperatorFactory
-
Field Summary
-
Fields inherited from interface io.trino.operator.Operator
NOT_BLOCKED
-
-
Constructor Summary
Constructors Constructor Description HashAggregationOperator(OperatorContext operatorContext, List<Type> groupByTypes, List<Integer> groupByChannels, List<Integer> globalAggregationGroupIds, AggregationNode.Step step, boolean produceDefaultOutput, List<AccumulatorFactory> accumulatorFactories, Optional<Integer> hashChannel, Optional<Integer> groupIdChannel, int expectedGroups, Optional<io.airlift.units.DataSize> maxPartialMemory, boolean spillEnabled, io.airlift.units.DataSize memoryLimitForMerge, io.airlift.units.DataSize memoryLimitForMergeWithMemory, SpillerFactory spillerFactory, JoinCompiler joinCompiler, BlockTypeOperators blockTypeOperators, boolean useSystemMemory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInput(Page page)Adds an input page to the operator.voidclose()This method will always be called before releasing the Operator reference.voidfinish()Notifies the operator that no more pages will be added and the operator should finish processing and flush results.voidfinishMemoryRevoke()Clean up and release resources after completed memory revoking.HashAggregationBuildergetAggregationBuilder()OperatorContextgetOperatorContext()PagegetOutput()Gets an output page from the operator.booleanisFinished()Is this operator completely finished processing and no more output pages will be produced.booleanneedsInput()Returns true if and only if this operator can accept an input page.com.google.common.util.concurrent.ListenableFuture<Void>startMemoryRevoke()After calling this method operator should revoke all reserved revocable memory.
-
-
-
Constructor Detail
-
HashAggregationOperator
public HashAggregationOperator(OperatorContext operatorContext, List<Type> groupByTypes, List<Integer> groupByChannels, List<Integer> globalAggregationGroupIds, AggregationNode.Step step, boolean produceDefaultOutput, List<AccumulatorFactory> accumulatorFactories, Optional<Integer> hashChannel, Optional<Integer> groupIdChannel, int expectedGroups, Optional<io.airlift.units.DataSize> maxPartialMemory, boolean spillEnabled, io.airlift.units.DataSize memoryLimitForMerge, io.airlift.units.DataSize memoryLimitForMergeWithMemory, SpillerFactory spillerFactory, JoinCompiler joinCompiler, BlockTypeOperators blockTypeOperators, boolean useSystemMemory)
-
-
Method Detail
-
getOperatorContext
public OperatorContext getOperatorContext()
- Specified by:
getOperatorContextin interfaceOperator
-
finish
public void finish()
Description copied from interface:OperatorNotifies the operator that no more pages will be added and the operator should finish processing and flush results. This method will not be called if the Task is already failed or canceled.
-
isFinished
public boolean isFinished()
Description copied from interface:OperatorIs this operator completely finished processing and no more output pages will be produced.- Specified by:
isFinishedin interfaceOperator
-
needsInput
public boolean needsInput()
Description copied from interface:OperatorReturns true if and only if this operator can accept an input page.- Specified by:
needsInputin interfaceOperator
-
addInput
public void addInput(Page page)
Description copied from interface:OperatorAdds an input page to the operator. This method will only be called ifneedsInput()returns true.
-
startMemoryRevoke
public com.google.common.util.concurrent.ListenableFuture<Void> startMemoryRevoke()
Description copied from interface:OperatorAfter calling this method operator should revoke all reserved revocable memory. As soon as memory is revoked returned future should be marked as done.Spawned threads cannot modify OperatorContext because it's not thread safe. For this purpose implement
Operator.finishMemoryRevoke()Since memory revoking signal is delivered asynchronously to the Operator, implementation must gracefully handle the case when there no longer is any revocable memory allocated.
After this method is called on Operator the Driver is disallowed to call any processing methods on it (isBlocked/needsInput/addInput/getOutput) until
Operator.finishMemoryRevoke()is called.- Specified by:
startMemoryRevokein interfaceOperator
-
finishMemoryRevoke
public void finishMemoryRevoke()
Description copied from interface:OperatorClean up and release resources after completed memory revoking. Called by driver once future returned by startMemoryRevoke is completed.- Specified by:
finishMemoryRevokein interfaceOperator
-
getOutput
public Page getOutput()
Description copied from interface:OperatorGets an output page from the operator. If no output data is currently available, return null.
-
close
public void close()
Description copied from interface:OperatorThis method will always be called before releasing the Operator reference.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceOperator
-
getAggregationBuilder
public HashAggregationBuilder getAggregationBuilder()
-
-