libenchao commented on code in PR #3053:
URL: https://github.com/apache/calcite/pull/3053#discussion_r1111002622


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -4474,6 +4474,21 @@ protected void validateWhereOrOn(
       SqlNode condition,
       String clause) {
     validateNoAggs(aggOrOverOrGroupFinder, condition, clause);
+    //  SqlSelect need to expand alias
+    condition.accept(new SqlShuttle() {
+      @Override public @Nullable SqlNode visit(SqlCall call) {
+        call.getOperandList()
+            .stream()
+            .filter(Objects::nonNull)
+            .forEach(node -> node.accept(this));
+        if (call.getKind() == SqlKind.SELECT) {
+          SqlSelect select = (SqlSelect) call;
+          validateHavingClause(select);

Review Comment:
   `validateWhereOrOn` is used not only to validate `where` clause, is your 
change also applies to `on` clause, is there any test covers this?



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