Class SyntheticColumns

java.lang.Object
org.elasticsearch.xpack.esql.datasources.SyntheticColumns

public final class SyntheticColumns extends Object
Helpers for reader-synthesized internal channels — columns with no backing source field, filled by the format reader from a per-format value source. Today the only synthetic kind is SyntheticColumns.Kind.ROW_POSITION (column name ColumnExtractor.ROW_POSITION_COLUMN), which the optimizer (InjectRowPositionForExternalId) injects whenever _id or _file.record_ref is requested; format readers fill the slot from their own per-format source (CSV counter, ORC RecordReader#getRowNumber, NDJSON byte offset, parquet-mr packed extractor id) and VirtualColumnIterator consumes it before the data reaches the user.

Distinct from virtual columns: virtual columns are user-visible names you can write in a METADATA clause (the MetadataAttribute.ATTRIBUTES_MAP names — _index, _id, _version, … — plus the _file.* family); they implement the VirtualAttribute marker. Synthetic columns are internal-only: the user cannot name _rowPosition in a query, but its value reaches the user via the virtual _file.record_ref and through _id's composition.

The SyntheticColumns.Kind registry is the single source of truth for the set of synthetic columns, their canonical names, and their attribute shapes — consumers derive a kind's behavior from its accessors rather than dispatching per member.

  • Field Details

    • NAMES

      public static final Set<String> NAMES
      Names of every reader-synthesized internal channel. The producer pipeline injects these, and rendering code (e.g. SynthesizeExternalSource) excludes them from the rendered _source object. User data columns whose names happen to start with _ (e.g. Spark's _corrupt_record, a user-supplied _status) are real data — a leading underscore on its own is not the filter; membership in this set is.
  • Method Details