sbroeder commented on code in PR #5271:
URL: https://github.com/apache/calcite/pull/5271#discussion_r4138882064


##########
core/src/main/java/org/apache/calcite/sql/validate/AliasNamespace.java:
##########
@@ -111,6 +111,7 @@ protected AliasNamespace(
                 rowType.getFieldList().get(0).getType())
             .build();
         aliasedType = node.getKind() == SqlKind.COLLECTION_TABLE
+                || (node.getKind() == SqlKind.UNNEST && 
isUnnestOfStructArray((SqlCall) node))
             ? new SingleColumnAliasRelDataType(rowType, singleColumnAlias) : 
singleColumnAlias;
         // If the sub-query is UNNEST with ordinality

Review Comment:
   Good catch!  Fixed by generalizing SingleColumnAliasRelDataType to accept an 
original with more than one field and using it here too.  The data column keeps 
its field name via getFieldList() and is also reachable via the alias from 
getField().  Select d, select d.a, and select * all resolve correctly now.  
Added select d, d.a and select * assertions to the test.



-- 
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]

Reply via email to