- All Superinterfaces:
AutoCloseable,Closeable,org.elasticsearch.core.Releasable
- All Known Implementing Classes:
AbstractPageMappingOperator,AbstractPageMappingToIteratorOperator,AggregationOperator,AsyncOperator,ChangePointOperator,ColumnExtractOperator,ColumnLoadOperator,EnrichQuerySourceOperator,EvalOperator,ExchangeSinkOperator,ExchangeSourceOperator,FilterOperator,HashAggregationOperator,LimitOperator,LocalSourceOperator,LuceneCountOperator,LuceneOperator,LuceneSourceOperator,LuceneTopNSourceOperator,MergePositionsOperator,MvExpandOperator,OutputOperator,PageConsumerOperator,ProjectOperator,RowInTableLookupOperator,RrfScoreEvalOperator,SampleOperator,ScoreOperator,ShowOperator,SinkOperator,SourceOperator,StringExtractOperator,TimeSeriesAggregationOperator,TimeSeriesExtractFieldOperator,TimeSeriesSourceOperator,TopNOperator,ValuesSourceReaderOperator
public interface Operator
extends org.elasticsearch.core.Releasable
Operator is low-level building block that consumes, transforms and produces data.
An operator can have state, and assumes single-threaded access.
Data is processed in smaller batches (termed
Pages) that are passed to
(see addInput(Page)) or retrieved from (see getOutput() operators.
The component that's in charge of passing data between operators is the Driver.
More details on how this integrates with other components can be found in the package documentation of
org.elasticsearch.compute-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA factory for creating intermediate operators.static interfaceStatus of anOperatorto be returned by the tasks API. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe minimum number of positions for aSourceOperatorto target generating.static final IsBlockedResultstatic final intTarget number of bytes in a page. -
Method Summary
Modifier and TypeMethodDescriptionvoidadds an input page to the operator.voidclose()notifies the operator that it won't be used anymore (i.e.voidfinish()notifies the operator that it won't receive any more input pagesreturns non-null if output page available.default IsBlockedResultAn operator can be blocked on some action (e.g.booleanwhether the operator has finished processing all input pages and made the corresponding output pages availablebooleanwhether the given operator can accept more input pagesdefault Operator.Statusstatus()The status of the operator.
-
Field Details
-
TARGET_PAGE_SIZE
static final int TARGET_PAGE_SIZETarget number of bytes in a page. By default we'll try and size pages so that they contain this many bytes. -
MIN_TARGET_PAGE_SIZE
static final int MIN_TARGET_PAGE_SIZEThe minimum number of positions for aSourceOperatorto target generating. This isn't 1 becauseBlocks have non-trivial overhead and it's just not worth building even smaller blocks without under normal circumstances.- See Also:
-
NOT_BLOCKED
-
-
Method Details
-
needsInput
boolean needsInput()whether the given operator can accept more input pages -
addInput
adds an input page to the operator. only called when needsInput() == true and isFinished() == false- Throws:
UnsupportedOperationException- if the operator is aSourceOperator
-
finish
void finish()notifies the operator that it won't receive any more input pages -
isFinished
boolean isFinished()whether the operator has finished processing all input pages and made the corresponding output pages available -
getOutput
Page getOutput()returns non-null if output page available. Only called when isFinished() == false- Throws:
UnsupportedOperationException- if the operator is aSinkOperator
-
close
void close()notifies the operator that it won't be used anymore (i.e. none of the other methods called), and its resources can be cleaned up- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.elasticsearch.core.Releasable
-
status
The status of the operator. -
isBlocked
An operator can be blocked on some action (e.g. waiting for some resources to become available). If so, it returns a future that completes when the operator becomes unblocked. If the operator is not blocked, this method returnsNOT_BLOCKEDwhich is an already completed future.
-