wirybeaver commented on code in PR #16204:
URL: https://github.com/apache/pinot/pull/16204#discussion_r2167841774


##########
pinot-query-planner/src/test/resources/queries/PhysicalOptimizerPlans.json:
##########
@@ -1,4 +1,154 @@
 {
+  "physical_opt_chained_subqueries": {
+    "queries": [
+      {
+        "description": "Sub-query with group-by with no agg calls and a limit",
+        "sql": "SET usePhysicalOptimizer=true; EXPLAIN PLAN FOR WITH tmp AS 
(SELECT DISTINCT col1, col2, ts FROM a LIMIT 100) SELECT col1, col2, RANK() 
OVER (PARTITION BY col2 ORDER BY ts DESC) AS rnk FROM tmp ORDER BY col2, rnk 
DESC",
+        "output": [
+          "Execution Plan",
+          "\nPhysicalExchange(exchangeStrategy=[SINGLETON_EXCHANGE])",
+          "\n  PhysicalSort(sort0=[$1], sort1=[$2], dir0=[ASC], dir1=[DESC])",
+          "\n    PhysicalProject(col1=[$0], col2=[$1], $2=[$3])",
+          "\n      PhysicalWindow(window#0=[window(partition {1} order by [2 
DESC] aggs [RANK()])])",
+          "\n        PhysicalSort(sort0=[$2], dir0=[DESC])",
+          "\n          PhysicalSort(fetch=[100])",
+          "\n            
PhysicalExchange(exchangeStrategy=[SINGLETON_EXCHANGE])",
+          "\n              PhysicalSort(fetch=[100])",
+          "\n                PhysicalAggregate(group=[{0, 1, 2}], 
aggType=[FINAL], limit=[100])",
+          "\n                  
PhysicalExchange(exchangeStrategy=[PARTITIONING_EXCHANGE], distKeys=[[0, 1, 
2]])",
+          "\n                    PhysicalAggregate(group=[{0, 1, 7}], 
aggType=[LEAF], limit=[100])",
+          "\n                      PhysicalTableScan(table=[[default, a]])",
+          "\n"
+        ]
+      }
+    ]
+  },
+  "physical_opt_group_by_hint_options": {
+    "queries": [
+      {
+        "description": "",
+        "sql": "SET usePhysicalOptimizer=true; EXPLAIN PLAN FOR SELECT /*+ 
aggOptions(is_leaf_return_final_result='true') */ col1, COUNT(DISTINCT col2) AS 
cnt FROM a WHERE col3 >= 0 GROUP BY col1 ORDER BY cnt DESC LIMIT 10",

Review Comment:
   Is `aggOptions(blah)` a special grammar?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to