You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2020/10/31 21:44:00 UTC

[jira] [Created] (CALCITE-4370) Ensure that all aggregate functions work in windowed aggregates

Julian Hyde created CALCITE-4370:
------------------------------------

             Summary: Ensure that all aggregate functions work in windowed aggregates
                 Key: CALCITE-4370
                 URL: https://issues.apache.org/jira/browse/CALCITE-4370
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde


Ensure that all aggregate functions work in windowed aggregates.

I made a simple modification:
{noformat}
diff --git a/core/src/test/java/org/apache/calcite/sql/test/SqlTests.java b/core/src/test/java/org/apache/calcite/sql/test/SqlTests.java
index 5404121fd..5a218538a 100644
--- a/core/src/test/java/org/apache/calcite/sql/test/SqlTests.java
+++ b/core/src/test/java/org/apache/calcite/sql/test/SqlTests.java
@@ -115,7 +115,7 @@ public static String getTypeString(RelDataType sqlType) {
 
   public static String generateAggQuery(String expr, String[] inputValues) {
     StringBuilder buf = new StringBuilder();
-    buf.append("SELECT ").append(expr).append(" FROM ");
+    buf.append("SELECT ").append(expr).append(" OVER () FROM ");
     if (inputValues.length == 0) {
       buf.append("(VALUES 1) AS t(x) WHERE false");
     } else {
{noformat}
and then ran {{SqlOperatorBaseTest}}, and got errors or failures in tests:
* {{COUNT}} disgregards {{DISTINCT}});
* {{COUNTIF}}, {{STRING_AGG}}, {{APPROX_COUNT_DISTINCT}}, and {{BIT_XOR}} are not implemented for windowed functions;
* {{STDDEV_SAMP}} returns zero for an empty window but should return null;
* {{JSON_ARRAY_AGG}} cannot even parse {{OVER}};
* miscellaneous other problems for {{BIT_AND}} {{ARRAY_AGG}}, {{COLLECT}}.

We should fix these problems, and ensure that {{SqlOperatorTest}} runs each aggregate function with {{OVER}} as well as {{GROUP BY}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)