Class SyntheticColumns
java.lang.Object
org.elasticsearch.xpack.esql.datasources.SyntheticColumns
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRegistry of reader-synthesized internal channels. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic SyntheticColumns.Kindstatic AttributeReader-side attribute shape for the slot ofkind: aReferenceAttributewhose type and nullability come from theSyntheticColumns.Kindrecord.static AttributeShorthand fornewAttribute(Kind.ROW_POSITION); kept for the kind-specific call sites.static MetadataAttributeOptimizer-side attribute shape for theSyntheticColumns.Kind.ROW_POSITIONslot: aMetadataAttributetyped and nullability-marked from theSyntheticColumns.Kindrecord, marked synthetic.static introwPositionIndexInAttributes(List<? extends Attribute> attributes) Index ofColumnExtractor.ROW_POSITION_COLUMNinattributes, by attribute name;-1when absent or the list isnull.static introwPositionIndexInNames(List<String> projectedColumns) Index ofColumnExtractor.ROW_POSITION_COLUMNinprojectedColumns, or-1when absent or the list isnull.
-
Field Details
-
NAMES
Names of every reader-synthesized internal channel. The producer pipeline injects these, and rendering code (e.g.SynthesizeExternalSource) excludes them from the rendered_sourceobject. 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
-
kindOf
-
rowPositionIndexInNames
Index ofColumnExtractor.ROW_POSITION_COLUMNinprojectedColumns, or-1when absent or the list isnull. -
rowPositionIndexInAttributes
Index ofColumnExtractor.ROW_POSITION_COLUMNinattributes, by attribute name;-1when absent or the list isnull. -
newAttribute
Reader-side attribute shape for the slot ofkind: aReferenceAttributewhose type and nullability come from theSyntheticColumns.Kindrecord. Used by format readers when they synthesize the projected attribute for a slot that has no source column behind it (e.g. the_rowPositionchannel inCsvFormatReader's switch onSyntheticColumns.Kind). -
newRowPositionAttribute
Shorthand fornewAttribute(Kind.ROW_POSITION); kept for the kind-specific call sites. -
newRowPositionMetadataAttribute
Optimizer-side attribute shape for theSyntheticColumns.Kind.ROW_POSITIONslot: aMetadataAttributetyped and nullability-marked from theSyntheticColumns.Kindrecord, marked synthetic. Paired withnewRowPositionAttribute()so type and nullability stay in lock-step between the optimizer injection site and the reader synthesis site.
-