mihaibudiu commented on code in PR #5114:
URL: https://github.com/apache/calcite/pull/5114#discussion_r3617758185
##########
core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java:
##########
@@ -297,6 +296,24 @@ protected SqlCall as(SqlNode e, String alias, String...
fieldNames) {
return SqlStdOperatorTable.AS.createCall(POS, operandList);
}
+ /** Wraps a column reference produced while expanding {@code SELECT *} in an
+ * {@code AS} alias when the column's intrinsic name differs from the
+ * (unique) row-type field name. Without this, a sub-query that wraps a join
+ * with duplicate field names (e.g. two columns named {@code DEPTNO}) would
+ * expose two identically named columns, which is ambiguous when referenced
+ * from an outer query.
+ *
+ * <p>See <a href="https://issues.apache.org/jira/browse/CALCITE-7663">
+ * [CALCITE-7663]</a>. */
+ private SqlNode expandedField(SqlNode fieldNode, String uniqueName) {
Review Comment:
I would remove the mention to the issue from this comment.
I would also give a more suggestive name to this function, perhaps renameAs.
The comment about the duplicate field names should be moved from this
function to the place where this function is called.
--
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]