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, OrdinalsGroupingOperator, OutputOperator, PageConsumerOperator, ProjectOperator, RowInTableLookupOperator, SampleOperator, ScoreOperator, ShowOperator, SinkOperator, SourceOperator, StringExtractOperator, 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 Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A factory for creating intermediate operators.
    static interface 
    Status of an Operator to be returned by the tasks API.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The minimum number of positions for a SourceOperator to target generating.
    static final IsBlockedResult
     
    static final int
    Target number of bytes in a page.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addInput(Page page)
    adds an input page to the operator.
    void
    notifies the operator that it won't be used anymore (i.e.
    void
    notifies the operator that it won't receive any more input pages
    returns non-null if output page available.
    An operator can be blocked on some action (e.g.
    boolean
    whether the operator has finished processing all input pages and made the corresponding output pages available
    boolean
    whether the given operator can accept more input pages
    The status of the operator.
  • Field Details

    • TARGET_PAGE_SIZE

      static final int TARGET_PAGE_SIZE
      Target 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_SIZE
      The minimum number of positions for a SourceOperator to target generating. This isn't 1 because Blocks have non-trivial overhead and it's just not worth building even smaller blocks without under normal circumstances.
      See Also:
    • NOT_BLOCKED

      static final IsBlockedResult NOT_BLOCKED
  • Method Details

    • needsInput

      boolean needsInput()
      whether the given operator can accept more input pages
    • addInput

      void addInput(Page page)
      adds an input page to the operator. only called when needsInput() == true and isFinished() == false
      Throws:
      UnsupportedOperationException - if the operator is a SourceOperator
    • 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 a SinkOperator
    • 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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.elasticsearch.core.Releasable
    • status

      default Operator.Status status()
      The status of the operator.
    • isBlocked

      default IsBlockedResult 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 returns NOT_BLOCKED which is an already completed future.