xiedeyantu commented on code in PR #4671:
URL: https://github.com/apache/calcite/pull/4671#discussion_r2612312065


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -489,9 +489,10 @@ private boolean expandSelectItem(final SqlNode selectItem, 
SqlSelect select,
       selectScope = getSelectScope(select);
       expanded = expandSelectExpr(selectItem, scope, select, expansions);
 
-      // Non-strict GROUP BY: wrap non-aggregated, non-grouped columns in 
ANY_VALUE()
+      // Non-strict GROUP BY or BY clause: wrap non-aggregated, non-grouped 
columns in ANY_VALUE()
       if (isAggregate(select)
-          && config.conformance().isNonStrictGroupBy()
+          && (config.conformance().isNonStrictGroupBy()
+          || select.hasByClause())

Review Comment:
   It is still necessary. It seems that in most scenarios, SELECT BY requires 
non-standard GROUP BY, so it needs to be enabled.



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