Class ExternalFieldExtractOperator

java.lang.Object
org.elasticsearch.xpack.esql.datasources.ExternalFieldExtractOperator
All Implemented Interfaces:
Closeable, AutoCloseable, Operator, Releasable

public class ExternalFieldExtractOperator extends Object implements Operator
Page-mapping operator that materializes deferred ("wide") columns for the rows surviving a per-driver TopN.

Reads the _rowPosition channel from each incoming page — these are encoded row references (extractor id packed with file-local position) written by the source factory. Calls SourceExtractors.materialize(long[], int, List, List, BlockFactory) to materialize the deferred columns, then assembles an output page that:

  • Keeps every input block except the _rowPosition channel.
  • Appends the deferred columns in the order requested at construction.

The registry is owned by the upstream AsyncExternalSourceOperatorFactory and resolved per-driver via a Function<DriverContext, SourceExtractors> supplied at construction. The source populates the registry as it opens files; this operator reads it after TopN finishes. Single-threaded — same driver thread.

Implements Operator directly rather than extending AbstractPageMappingOperator because the latter short-circuits zero-position pages — that would propagate the input shape (including _rowPosition) instead of our declared output shape, breaking downstream channel indexing.