You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "siddharthteotia (via GitHub)" <gi...@apache.org> on 2023/02/22 08:40:34 UTC

[GitHub] [pinot] siddharthteotia commented on a diff in pull request #10248: [multi-stage] Support query plan for GROUP BY only in the intermediary stage

siddharthteotia commented on code in PR #10248:
URL: https://github.com/apache/pinot/pull/10248#discussion_r1113997692


##########
pinot-query-planner/src/test/resources/queries/GroupByPlans.json:
##########
@@ -91,6 +91,92 @@
           "\n                  LogicalTableScan(table=[[a]])",
           "\n"
         ]
+      },
+      {
+        "description": "SQL hint based group by optimization with select and aggregate column",
+        "sql": "EXPLAIN PLAN FOR SELECT /*+ SKIP_LEAF_STAGE_GROUP_BY_AGGREGATION */ a.col1, SUM(a.col3) FROM a GROUP BY a.col1",
+        "output": [
+          "Execution Plan",
+          "\nLogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])",
+          "\n  LogicalExchange(distribution=[hash[0]])",
+          "\n    LogicalProject(col1=[$2], col3=[$1])",
+          "\n      LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "SQL hint based group by optimization with filter",
+        "sql": "EXPLAIN PLAN FOR SELECT /*+ SKIP_LEAF_STAGE_GROUP_BY_AGGREGATION */ a.col1, SUM(a.col3) FROM a WHERE a.col3 >= 0 AND a.col2 = 'a' GROUP BY a.col1",
+        "output": [
+          "Execution Plan",
+          "\nLogicalAggregate(group=[{2}], EXPR$1=[$SUM0($1)])",
+          "\n  LogicalExchange(distribution=[hash[2]])",
+          "\n    LogicalProject(col2=[$0], col3=[$1], col1=[$2])",
+          "\n      LogicalFilter(condition=[AND(>=($1, 0), =($0, 'a'))])",
+          "\n        LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "SQL hint based group by optimization count(*) with filter",
+        "sql": "EXPLAIN PLAN FOR SELECT /*+ SKIP_LEAF_STAGE_GROUP_BY_AGGREGATION */ a.col1, COUNT(*) FROM a WHERE a.col3 >= 0 AND a.col2 = 'a' GROUP BY a.col1",
+        "notes": "TODO: Needs follow up. Project should only keep a.col1 since the other columns are pushed to the filter, but it currently keeps them all",
+        "output": [
+          "Execution Plan",
+          "\nLogicalAggregate(group=[{2}], EXPR$1=[COUNT()])",
+          "\n  LogicalExchange(distribution=[hash[2]])",
+          "\n    LogicalProject(col2=[$0], col3=[$1], col1=[$2])",
+          "\n      LogicalFilter(condition=[AND(>=($1, 0), =($0, 'a'))])",
+          "\n        LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "SQL hint based group by optimization on 2 columns with filter",
+        "sql": "EXPLAIN PLAN FOR SELECT /*+ SKIP_LEAF_STAGE_GROUP_BY_AGGREGATION */ a.col2, a.col1, SUM(a.col3) FROM a WHERE a.col3 >= 0 AND a.col1 = 'a'  GROUP BY a.col1, a.col2",

Review Comment:
   +1



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