Class SynthesizeExternalSource
java.lang.Object
org.elasticsearch.xpack.esql.datasources.SynthesizeExternalSource
Producer-side composition of the
_source metadata column for external datasets.
For each row, the bound data columns (<name, value> pairs at that row's position) are
gathered into a Map, JSON-serialized via
Source.fromMap(Map, XContentType), and emitted as a BytesRef of type
DataType.SOURCE.
Renders via Source.fromMap(java.util.Map<java.lang.String, java.lang.Object>, org.elasticsearch.xcontent.XContentType) so the output matches what SourceLoader
produces for natively-stored indexed documents — a downstream consumer that already knows
how to parse _source (e.g. Kibana's row-detail view) works unchanged.
This is producer-side and per-row; callers project _source sparingly because the
cost is linear in the bound data column count and dominated by JSON serialization. The
upstream binding gates _source only on explicit METADATA _source.
-
Method Summary
Modifier and TypeMethodDescriptionstatic BytesRefBlockcomposePage(String[] dataColumnNames, DataType[] dataColumnTypes, Block[] dataColumnBlocks, int positions, BlockFactory factory) Build a_sourceblock of lengthpositionsby composing one JSON object per row from the supplied data columns.
-
Method Details
-
composePage
public static BytesRefBlock composePage(String[] dataColumnNames, DataType[] dataColumnTypes, Block[] dataColumnBlocks, int positions, BlockFactory factory) Build a_sourceblock of lengthpositionsby composing one JSON object per row from the supplied data columns. Each entry indataColumnNamesis paired positionally with the matching type indataColumnTypesand block indataColumnBlocks; columns named inSYNTHETIC_COLUMN_NAMES(framework-injected channels likeColumnExtractor.ROW_POSITION_COLUMN) are excluded. A leading underscore on its own is NOT a filter — user data columns named e.g._corrupt_recordor_statusare legitimate data and pass through to the rendered object. Values render per their declaredDataType, mirroring what the response layer (PositionToXContent) emits for the same columns — seeExternalScalarRenderer.render(java.lang.Object, org.elasticsearch.xpack.esql.core.type.DataType).
-