sbroeder commented on code in PR #5271:
URL: https://github.com/apache/calcite/pull/5271#discussion_r4178032650
##########
core/src/main/java/org/apache/calcite/rel/type/SingleColumnAliasRelDataType.java:
##########
@@ -59,7 +63,7 @@ public SingleColumnAliasRelDataType(RelDataType original,
RelDataType alias) {
}
@Override public int getFieldCount() {
- return 1;
+ return original.getFieldCount();
}
Review Comment:
Ack. Should be addressed in 7c6b0c09
##########
core/src/main/java/org/apache/calcite/sql/validate/AliasNamespace.java:
##########
@@ -100,29 +100,36 @@ protected AliasNamespace(
final RelDataType aliasedType;
if (operands.size() == 2) {
final SqlNode node = operands.get(0);
- // Alias is 'AS t' (no column list).
- // If the sub-query is UNNEST or VALUES,
- // and the sub-query has one column,
- // then the namespace's sole column is named after the alias.
+ // 'AS t': the sole column is named after the alias, unless it is a
+ // field of the collection's ROW element. COLLECTION_TABLE's sole
+ // column keeps its own name the same way.
+ final boolean isStructUnnest = node.getKind() == SqlKind.UNNEST
+ && keepsElementFieldName((SqlCall) node);
Review Comment:
Ack. Should be addressed in 7c6b0c09
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]