xuzifu666 commented on code in PR #5240:
URL: https://github.com/apache/calcite/pull/5240#discussion_r3943034568
##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -638,6 +638,107 @@ private List<String> deriveNaturalJoinColumnList(SqlJoin
join) {
getNamespaceOrThrow(join.getRight()).getRowType());
}
+ /** Expands an identifier that refers to a common column of a NATURAL or
+ * USING join into a qualified reference or, for FULL JOIN, a COALESCE
+ * expression. */
+ SqlNode expandCommonColumn(SqlSelect sqlSelect, SqlNode selectItem,
+ SelectScope scope) {
+ return expandCommonColumn(sqlSelect, selectItem, scope, true);
+ }
+
+ /** As {@link #expandCommonColumn(SqlSelect, SqlNode, SelectScope)}, but
+ * allows control over whether the result is wrapped with an {@code AS}
+ * operator to preserve the column alias. */
+ SqlNode expandCommonColumn(SqlSelect sqlSelect, SqlNode selectItem,
Review Comment:
Let me explain this in detail here: The latest commit (c44fc3f35) touches
only `AggChecker.isGroupExpr` and contains no wrapAlias-related changes.
It addresses the previous review comment: the two equalsDeep calls are
consolidated into a single comparison that strips the `AS` wrapper from both
sides, while measure expressions are still compared exactly. All wrapAlias
changes — the new parameter, the two-argument overload, and the `ORDER BY` call
sites are in the first commit 3d6c4cf90 (`SqlValidatorImpl.java`), along with
the original `AggChecker` change and the tests.
--
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]