You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/11/21 21:09:42 UTC

[GitHub] [pinot] agavra commented on a diff in pull request #9811: [Multistage][Testing] Integration test for general aggregate functions.

agavra commented on code in PR #9811:
URL: https://github.com/apache/pinot/pull/9811#discussion_r1028513067


##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/QueryRunnerTestBase.java:
##########
@@ -251,6 +251,9 @@ private static List<String> toH2FieldNamesAndTypes(org.apache.pinot.spi.data.Sch
         case DOUBLE:
           fieldType = "double";
           break;
+        case BOOLEAN:

Review Comment:
   I think this is already merged - please rebase 😄 



##########
pinot-query-runtime/src/test/resources/queries/Aggregates.json:
##########
@@ -0,0 +1,297 @@
+{
+  "general_aggregate": {
+    "tables": {
+      "tbl": {
+        "schema": [
+          {
+            "name": "int_col",
+            "type": "INT"
+          },
+          {
+            "name": "double_col",
+            "type": "DOUBLE"
+          },
+          {
+            "name": "string_col",
+            "type": "STRING"
+          },
+          {
+            "name": "bool_col",
+            "type": "BOOLEAN"
+          }
+        ],
+        "inputs": [
+          [
+            2,
+            300,
+            "a",
+            true
+          ],
+          [
+            2,
+            400,
+            "a",
+            false
+          ],
+          [
+            3,
+            100,
+            "b",
+            true
+          ],
+          [
+            100,
+            1,
+            "b",
+            false
+          ],
+          [
+            101,
+            1.01,
+            "c",
+            false
+          ],
+          [
+            150,
+            1.5,
+            "c",
+            false
+          ],
+          [
+            175,
+            1.75,
+            "c",
+            true
+          ]
+        ]
+      }
+    },
+    "queries": [
+      {
+        "psql": "4.2.7",
+        "ignored": true,
+        "comments": "result error:average doesn't work because we round up but h2 round down for integer",
+        "description": "average int",
+        "sql": "SELECT avg(int_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "average double",
+        "sql": "SELECT avg(double_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "average double with filter",
+        "sql": "SELECT avg(double_col) FROM {tbl} WHERE double_col >= 100"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "sum double",
+        "sql": "SELECT sum(double_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "sum int",
+        "sql": "SELECT sum(int_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "max double",
+        "sql": "SELECT max(double_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "max int",
+        "sql": "SELECT max(int_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "count int",
+        "sql": "SELECT count(int_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "count double",
+        "sql": "SELECT count(double_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "count, sum group by order by",
+        "sql": "select string_col, count(int_col), sum(double_col) from {tbl} group by string_col order by string_col;"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "min, max",
+        "sql": "SELECT min(int_col), max(int_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "comments": "plan error:Unsupported SQL aggregation kind: {}. Only splittable aggregation functions are supported! [SINGLE_VALUE]",
+        "ignored": true,
+        "description": "outer aggregate",
+        "sql": "select  (select max((select i.int_col from {tbl} i where i.int_col = o.int_col))) from {tbl} o;"
+      },
+      {
+        "psql": "4.2.7",
+        "ignored": true,
+        "description": "nested",
+        "comments": "this should throw an error",
+        "sql": "SELECT min(max(int_col)) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "ignored": true,
+        "description": "nested",
+        "comments": "this should throw an error",
+        "sql": "SELECT (SELECT max(min({int_col})) FROM {tbl}) from {tbl};"
+      },
+      {
+        "psql": "4.2.7",
+        "ignored": true,
+        "comments": "parsing error:ORDER BY unexpected",
+        "description": "filter",
+        "sql": "SELECT min(double_col ORDER BY int_col) FROM {tbl}"

Review Comment:
   are these failed tests expected failures or tests that should fail but don't? if they should fail but don't we should add expectedException instead of ignoring them



##########
pinot-query-runtime/src/test/resources/queries/Aggregates.json:
##########
@@ -0,0 +1,297 @@
+{
+  "general_aggregate": {
+    "tables": {
+      "tbl": {
+        "schema": [
+          {
+            "name": "int_col",
+            "type": "INT"
+          },
+          {
+            "name": "double_col",
+            "type": "DOUBLE"
+          },
+          {
+            "name": "string_col",
+            "type": "STRING"
+          },
+          {
+            "name": "bool_col",
+            "type": "BOOLEAN"
+          }
+        ],
+        "inputs": [
+          [
+            2,
+            300,
+            "a",
+            true
+          ],
+          [
+            2,
+            400,
+            "a",
+            false
+          ],
+          [
+            3,
+            100,
+            "b",
+            true
+          ],
+          [
+            100,
+            1,
+            "b",
+            false
+          ],
+          [
+            101,
+            1.01,
+            "c",
+            false
+          ],
+          [
+            150,
+            1.5,
+            "c",
+            false
+          ],
+          [
+            175,
+            1.75,
+            "c",
+            true
+          ]
+        ]
+      }
+    },
+    "queries": [
+      {
+        "psql": "4.2.7",
+        "ignored": true,
+        "comments": "result error:average doesn't work because we round up but h2 round down for integer",
+        "description": "average int",
+        "sql": "SELECT avg(int_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "average double",
+        "sql": "SELECT avg(double_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "average double with filter",
+        "sql": "SELECT avg(double_col) FROM {tbl} WHERE double_col >= 100"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "sum double",
+        "sql": "SELECT sum(double_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "sum int",
+        "sql": "SELECT sum(int_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "max double",
+        "sql": "SELECT max(double_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "max int",
+        "sql": "SELECT max(int_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "count int",
+        "sql": "SELECT count(int_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "count double",
+        "sql": "SELECT count(double_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "count, sum group by order by",
+        "sql": "select string_col, count(int_col), sum(double_col) from {tbl} group by string_col order by string_col;"
+      },
+      {
+        "psql": "4.2.7",
+        "description": "min, max",
+        "sql": "SELECT min(int_col), max(int_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "comments": "plan error:Unsupported SQL aggregation kind: {}. Only splittable aggregation functions are supported! [SINGLE_VALUE]",
+        "ignored": true,
+        "description": "outer aggregate",
+        "sql": "select  (select max((select i.int_col from {tbl} i where i.int_col = o.int_col))) from {tbl} o;"
+      },
+      {
+        "psql": "4.2.7",
+        "ignored": true,
+        "description": "nested",
+        "comments": "this should throw an error",
+        "sql": "SELECT min(max(int_col)) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "ignored": true,
+        "description": "nested",
+        "comments": "this should throw an error",
+        "sql": "SELECT (SELECT max(min({int_col})) FROM {tbl}) from {tbl};"
+      },
+      {
+        "psql": "4.2.7",
+        "ignored": true,
+        "comments": "parsing error:ORDER BY unexpected",
+        "description": "filter",
+        "sql": "SELECT min(double_col ORDER BY int_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "ignored": true,
+        "comments": "NumberFormatException: For input string: \"a\"",
+        "description": "filter",
+        "sql": "SELECT min(string_col) FROM {tbl}"
+      },
+      {
+        "psql": "4.2.7",
+        "ignored": true,
+        "comments": "class java.lang.Double cannot be cast to class java.lang.Boolean",
+        "description": "filter",
+        "sql": "SELECT min(bool_col) FROM {tbl}"
+      }
+    ]
+  },
+  "aggregate_filter": {
+    "tables": {
+      "tbl": {
+        "schema": [
+          {
+            "name": "int_col",
+            "type": "INT"
+          },
+          {
+            "name": "double_col",
+            "type": "DOUBLE"
+          },
+          {
+            "name": "string_col",
+            "type": "STRING"
+          },
+          {
+            "name": "bool_col",
+            "type": "BOOLEAN"
+          }
+        ],
+        "inputs": [
+          [
+            2,
+            300,
+            "a",
+            false
+          ],
+          [
+            2,
+            400,
+            "a",
+            true
+          ],
+          [
+            3,
+            100,
+            "b",
+            true
+          ],
+          [
+            0.001,
+            1,
+            "b",
+            false
+          ],
+          [
+            101,
+            1.01,
+            "c",
+            false
+          ],
+          [
+            150,
+            1.5,
+            "c",
+            true
+          ],
+          [
+            175,
+            1.75,
+            "c",
+            true
+          ],
+          [
+            -10000,
+            1.75,
+            "c",
+            false
+          ],
+          [
+            -2,
+            0.5,
+            "c",
+            false
+          ]
+        ]
+      }
+    },
+    "queries": [
+      {
+        "psql": "4.2.7",
+        "description": "filter",

Review Comment:
   can we update these descriptions to be more meaningful? it's not clear to me what each of these are testing



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org