Class ExternalMetadataColumns
java.lang.Object
org.elasticsearch.xpack.esql.datasources.ExternalMetadataColumns
Registry of the standard ES index metadata names (
_id, _index,
_version, ...) that the external-source pipeline knows how to materialise on
external datasets. The data types are sourced from
MetadataAttribute.ATTRIBUTES_MAP so the binding here and in the analyzer
always agree (including snapshot-only entries such as _tier).
Sibling to FileMetadataColumns (_file.*). Both families are request-driven
(the user names them in METADATA) and materialized by VirtualColumnIterator
on the producer thread; the split exists because _file.* comes from per-file stat
while the standard names route through MetadataAttribute.ATTRIBUTES_MAP.
Two materialisation lanes exist: see PER_FILE_CONSTANT_NAMES for the canonical
per-file-constant set; the remaining standard names (_id via
ExternalRowIdentity, _source via SynthesizeExternalSource) are
per-row composed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringNames of standard metadata columns that are materialised by the producer-side constant-block path (per-file values, including SQLNULLwhere unavailable).The dedicated metadata namespace for reservation/rename purposes:STANDARD_NAMESplus every standard name that is only snapshot-gated for binding (_tier).static final Stringstatic final Stringstatic final Stringstatic final StringEvery standard metadata name an external relation can bind —PER_FILE_CONSTANT_NAMESplus the per-row composed pair (ID,SOURCE).static final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionextractPerFileConstants(String datasetName, Long lastModifiedMillis) Variant for callers that already hold the file's last-modified epoch-millis (e.g.extractPerFileConstants(String datasetName, FileList fileList, int index) Build the per-file constant values for the standard metadata names listed inPER_FILE_CONSTANT_NAMES.
-
Field Details
-
ID
- See Also:
-
INDEX
- See Also:
-
VERSION
- See Also:
-
SCORE
- See Also:
-
SOURCE
- See Also:
-
IGNORED
- See Also:
-
INDEX_MODE
- See Also:
-
TSID
- See Also:
-
SIZE
- See Also:
-
SLICE
- See Also:
-
PER_FILE_CONSTANT_NAMES
Names of standard metadata columns that are materialised by the producer-side constant-block path (per-file values, including SQLNULLwhere unavailable). The other standard names (ID,SOURCE) are not in this set — they go through per-row composition operators (ExternalRowIdentity,SynthesizeExternalSource). -
STANDARD_NAMES
Every standard metadata name an external relation can bind —PER_FILE_CONSTANT_NAMESplus the per-row composed pair (ID,SOURCE). This is the dedicated namespace: dataset layouts (Hive partition directories, data columns) cannot claim these names; seeHivePartitionDetectorfor the rename that enforces it. -
RESERVED_NAMES
The dedicated metadata namespace for reservation/rename purposes:STANDARD_NAMESplus every standard name that is only snapshot-gated for binding (_tier). Reservation must not flip with build mode — a dataset layout claiming_tieris renamed to_partition._tierin EVERY build, even whereMETADATA _tieritself is not yet exposed — so a Hive dataset surfaces the same column names regardless of snapshot vs release. Use this set for namespace protection; useSTANDARD_NAMESfor what a relation may actually bind.
-
-
Method Details
-
extractPerFileConstants
public static Map<String,Object> extractPerFileConstants(@Nullable String datasetName, FileList fileList, int index) Build the per-file constant values for the standard metadata names listed inPER_FILE_CONSTANT_NAMES. The map is suitable for merging into a partition-value map consumed byVirtualColumnIterator. Values are:_index—datasetNamewhen known, otherwisenull(bare-globFROMqueries have no dataset identity)._version—FileList.lastModifiedMillis(int)as aLong;0Lis treated as "unknown" and yieldsnullper the precedent set byFileMetadataColumns.extractValues(FileList, int).- Every other standard name —
null. They are not addressable on external data (no relevance scoring, no per-row_ignoredlist, etc.).
VirtualColumnIteratorrenders constant blocks of the correct type (DataType) — null values are turned intonewConstantNullBlockby the iterator's existing path. -
extractPerFileConstants
public static Map<String,Object> extractPerFileConstants(@Nullable String datasetName, @Nullable Long lastModifiedMillis) Variant for callers that already hold the file's last-modified epoch-millis (e.g. the slice-queue path, which reusesFileMetadataColumns.MODIFIEDpreviously stuffed into theFileSplit's partition values). AnulllastModifiedMillisyields anull_version; zero is treated as "unknown" perFileMetadataColumns.extractValues(FileList, int)precedent.
-