Class PageToBatchPageOperator

java.lang.Object
org.elasticsearch.compute.operator.SinkOperator
org.elasticsearch.compute.operator.exchange.PageToBatchPageOperator
All Implemented Interfaces:
Closeable, AutoCloseable, Operator, Releasable

public final class PageToBatchPageOperator extends SinkOperator
Operator that wraps a sink and converts Pages to BatchPages before passing them to the sink. This ensures all output pages have batch metadata attached.

Implements single-page buffering to optimize batch marker handling:

  • Buffers one page at a time
  • When a new page arrives, sends the buffered page with isLastPageInBatch=false and buffers the new one
  • When batch ends, flushBatch() sends the buffered page with isLastPageInBatch=true
  • If no pages were produced (empty result), sends an empty marker page
  • Method Details

    • needsInput

      public boolean needsInput()
      Description copied from interface: Operator
      whether the given operator can accept more input pages
    • doAddInput

      protected void doAddInput(Page page)
      Specified by:
      doAddInput in class SinkOperator
    • finish

      public void finish()
      Description copied from interface: Operator
      notifies the operator that it won't receive any more input pages
    • isFinished

      public boolean isFinished()
      Description copied from interface: Operator
      whether the operator has finished processing all input pages and made the corresponding output pages available
    • close

      public void close()
      Description copied from interface: Operator
      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