61yao commented on code in PR #9811:
URL: https://github.com/apache/pinot/pull/9811#discussion_r1028587254


##########
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:
   Added the expectedException for the one we expect it to fail. For others, we 
don't expect them to fail. I copied those test cases from psql test.



##########
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:
   Updated the description.



-- 
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-unsubscr...@pinot.apache.org

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


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

Reply via email to