Language
Projection and Aliases
Projection selects fields from the input payload.
Guide
Projection selects fields from the input payload.
sql
SELECT category, region INTO output FROM inputTested input:
jsonl
{"category":"a","region":"east"}
{"category":"b","region":"west"}Tested output:
jsonl
{"category":"a","region":"east"}
{"category":"b","region":"west"}Nested Fields
Nested paths use dot notation:
sql
SELECT field1.field2.field3.field4.field5 INTO output FROM inputQualified paths may include the input name:
sql
SELECT input.field1.field2.field3.field4.field5 INTO output FROM inputAliases
Aliases rename projected fields:
sql
SELECT value AS v, category AS c INTO output FROM inputTested input:
json
{"value":5,"category":"x"}Tested output behavior:
json
{"v":5,"c":"x"}Aliases can produce nested output paths by using bracketed names:
sql
SELECT field1.field2.field3 AS [a.b.c] INTO output FROM inputTested output behavior:
json
{"a":{"b":{"c":42}}}Nested source fields can also be merged:
sql
SELECT field1.field2, field1.field3 INTO output FROM inputTested input:
json
{"field1":{"field2":10,"field3":20}}Tested output behavior:
json
{"field1":{"field2":10,"field3":20}}If duplicate aliases are used, the last projection wins:
sql
SELECT value AS x, category AS x INTO output FROM inputTested input:
json
{"value":5,"category":"cat"}Tested output behavior:
json
{"x":"cat"}Scalar Function Projection
Scalar or aggregate function projections require aliases. The tests include:
sql
SELECT ABS(value) AS absValue INTO output FROM inputand reject:
sql
SELECT ABS(value) INTO output FROM inputThe test suite also contains a scalar projection shaped as:
sql
SELECT avg(value) AS absValue INTO output FROM inputThis query is accepted because the function projection has an alias.