Class NullSpliceRowPositionStrategy

java.lang.Object
org.elasticsearch.xpack.esql.datasources.spi.NullSpliceRowPositionStrategy
All Implemented Interfaces:
RowPositionStrategy

public final class NullSpliceRowPositionStrategy extends Object implements RowPositionStrategy
Strategy for readers that have no native row-position channel and must surface _rowPosition as a NULL column (parquet-rs today; the Rust bridge does not yet expose row positions). The reader strips _rowPosition from its native projection so the inner iterator's pages do not carry the column at all; apply(org.elasticsearch.compute.operator.CloseableIterator<org.elasticsearch.compute.data.Page>, int) wraps the iterator and splices a constant-null LongBlock at the slot the user's projection requested.

The downstream VirtualColumnIterator composes _id from the row-position channel; a null splice yields null _file.record_ref and null _id, matching the documented "row-position unsupported on this reader" semantics. The reason() string carries the explanation the wrapping iterator embeds in its describe() output.

  • Constructor Details

    • NullSpliceRowPositionStrategy

      public NullSpliceRowPositionStrategy(BlockFactory blockFactory, String reason)
      Parameters:
      blockFactory - used to allocate the per-page null block; carry the same factory the reader uses for its inner iterator so block ownership and breaker accounting stay coherent.
      reason - user-facing reason this reader cannot supply a real row position (surfaced in reason() and in iterator describe()).
  • Method Details

    • reason

      public String reason()
      Description copied from interface: RowPositionStrategy
      Human-readable reason why this strategy emits the shape it does, available to wrapping iterators for their describe() output (the null-splice iterator embeds it) so _id composition against a null-splice reader is attributable rather than silently null. The default returns the simple class name; the null-splice strategy overrides to expose its constructor reason.
      Specified by:
      reason in interface RowPositionStrategy
    • apply

      public CloseableIterator<Page> apply(CloseableIterator<Page> inner, int rowPositionSlot)
      Description copied from interface: RowPositionStrategy
      Wrap (or pass through) the reader's inner page iterator so each page has the _rowPosition slot populated. Validates any preconditions this strategy requires; throws IllegalStateException when a precondition is unmet (e.g. byte-offset strategy called with no decompressed anchor).
      Specified by:
      apply in interface RowPositionStrategy
      Parameters:
      rowPositionSlot - the index in the projected output where _rowPosition sits, or -1 when _rowPosition is not in the projection. The dispatcher pre-computes this once per reader.read() so strategies inspect a primitive instead of walking a list per call.