mihaibudiu commented on code in PR #4548:
URL: https://github.com/apache/calcite/pull/4548#discussion_r2370318193


##########
core/src/test/resources/sql/agg.iq:
##########
@@ -4126,4 +4126,40 @@ GROUP BY DEPTNO, JOB;
 
 !ok
 
+# [CALCITE-7189] Support MySQL-style non-standard GROUP BY
+!use scott-babel

Review Comment:
   if any_value is non-deterministic, I wonder how these results were validated
   



##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -526,6 +534,34 @@ private boolean expandSelectItem(final SqlNode selectItem, 
SqlSelect select,
     return false;
   }
 
+  /**
+   * Returns true if the node is a non-aggregated, non-grouped column in 
SELECT.
+   */
+  private boolean isNonAggregatedNonGroupedColumn(SqlNode node, SqlSelect 
select) {
+    if (aggFinder.findAgg(node) != null) {
+      return false;
+    }
+
+    if (node instanceof SqlIdentifier) {
+      SqlNodeList groupList = select.getGroup();
+      if (groupList == null) {
+        return true;
+      }
+      return groupList.getList().stream()
+          .noneMatch(groupItem -> groupItem != null
+              && node.equalsDeep(groupItem, Litmus.IGNORE));
+    }
+
+    if (node instanceof SqlCall) {

Review Comment:
   I assume this function is non-deterministic



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