Sean Broeder created CALCITE-7791:
-------------------------------------
Summary: UNNEST of a single-field ROW array loses the field name
when aliased
Key: CALCITE-7791
URL: https://issues.apache.org/jira/browse/CALCITE-7791
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.42.0
Reporter: Sean Broeder
Assignee: Sean Broeder
AliasNamespace.validateImpl() already handles this ambiguity for table
functions. For example, SELECT rmp, rmp.i FROM TABLE(ramp(3)) AS rmp works
because a 1-column result aliased with no column list gets wrapped in
SingleColumnAliasRelDataType. This was added in CALCITE-5779. However, that
wrapping only triggers for SqlKind.COLLECTION_TABLE.
UNNEST hits the same ambiguity and isn't covered.
SqlUnnestOperator#inferReturnType flattens a single-field ROW array element to
the top level, producing the same 1-field row shape, but AliasNamespace falls
through to the plain branch instead and renames that field to the alias and
discards its real name.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)