Package io.trino.operator
Interface Operator
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
SourceOperator
- All Known Implementing Classes:
AggregationOperator,DevNullOperator,DistinctLimitOperator,DynamicFilterSourceOperator,EnforceSingleRowOperator,ExchangeOperator,ExplainAnalyzeOperator,FinishedOperator,GroupIdOperator,HashAggregationOperator,HashBuilderOperator,HashBuilderOperator,IndexSourceOperator,LeafTableFunctionOperator,LimitOperator,LocalExchangeSinkOperator,LocalExchangeSourceOperator,LocalMergeSourceOperator,LookupOuterOperator,MarkDistinctOperator,MergeOperator,MergeWriterOperator,NestedLoopBuildOperator,NestedLoopJoinOperator,NullOutputOperator,OrderByOperator,PageBufferOperator,PageConsumerOperator,PagesIndexBuilderOperator,PageSourceOperator,PartitionedOutputOperator,RefreshMaterializedViewOperator,RowNumberOperator,SetBuilderOperator,SimpleTableExecuteOperator,SpatialIndexBuilderOperator,SpatialJoinOperator,StatisticsWriterOperator,TableFinishOperator,TableFunctionOperator,TableMutationOperator,TableScanOperator,TableWriterOperator,TaskOutputOperator,TopNRankingOperator,UnnestOperator,ValuesOperator,WindowOperator,WorkProcessorOperatorAdapter,WorkProcessorSourceOperatorAdapter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.common.util.concurrent.ListenableFuture<Void> -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an input page to the operator.default 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.default voidClean up and release resources after completed memory revoking.Gets an output page from the operator.default com.google.common.util.concurrent.ListenableFuture<Void> Returns a future that will be completed when the operator becomes unblocked.booleanIs this operator completely finished processing and no more output pages will be produced.booleanReturns true if and only if this operator can accept an input page.default com.google.common.util.concurrent.ListenableFuture<Void> After calling this method operator should revoke all reserved revocable memory.
-
Field Details
-
NOT_BLOCKED
-
-
Method Details
-
getOperatorContext
OperatorContext getOperatorContext() -
isBlocked
Returns a future that will be completed when the operator becomes unblocked. If the operator is not blocked, this method should returnNOT_BLOCKED. -
needsInput
boolean needsInput()Returns true if and only if this operator can accept an input page. -
addInput
Adds an input page to the operator. This method will only be called ifneedsInput()returns true. -
getOutput
Page getOutput()Gets an output page from the operator. If no output data is currently available, return null. -
startMemoryRevoke
After 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
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 most of processing methods on it (
isBlocked()/needsInput()/addInput(Page)/getOutput()) untilfinishMemoryRevoke()is called.finish()is the only processing method that can be called during that time andclose()remains callable at any time. -
finishMemoryRevoke
default void finishMemoryRevoke()Clean up and release resources after completed memory revoking. Called by driver once future returned by startMemoryRevoke is completed. -
finish
void finish()Notifies 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
boolean isFinished()Is this operator completely finished processing and no more output pages will be produced. -
close
This method will always be called before releasing the Operator reference.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-