You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ro...@apache.org on 2023/07/24 19:01:20 UTC

[pinot] branch master updated: [multistage][hotfix] should never pull project up below sort (#11161)

This is an automated email from the ASF dual-hosted git repository.

rongr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 41b3c70906 [multistage][hotfix] should never pull project up below sort (#11161)
41b3c70906 is described below

commit 41b3c70906b9d1f4550c3d3dcf9c3a8d99c65cc4
Author: Rong Rong <ro...@apache.org>
AuthorDate: Mon Jul 24 12:01:12 2023 -0700

    [multistage][hotfix] should never pull project up below sort (#11161)
    
    * [multistage][hotfix] should never pull project up below sort
    
    ---------
    
    Co-authored-by: Rong Rong <ro...@startree.ai>
---
 .../org/apache/calcite/rel/rules/PinotQueryRuleSets.java |  2 --
 .../src/test/resources/queries/BasicQueryPlans.json      | 16 ++++++++--------
 .../src/test/resources/queries/JoinPlans.json            | 16 ++++++++--------
 .../src/test/resources/queries/OrderByPlans.json         | 16 ++++++++--------
 4 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java
index 9b379a6890..34fe035212 100644
--- a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java
+++ b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java
@@ -60,8 +60,6 @@ public class PinotQueryRuleSets {
           CoreRules.PROJECT_MERGE,
           // remove identity project
           CoreRules.PROJECT_REMOVE,
-          // reorder sort and projection
-          CoreRules.SORT_PROJECT_TRANSPOSE,
 
           // convert OVER aggregate to logical WINDOW
           CoreRules.PROJECT_TO_LOGICAL_PROJECT_AND_WINDOW,
diff --git a/pinot-query-planner/src/test/resources/queries/BasicQueryPlans.json b/pinot-query-planner/src/test/resources/queries/BasicQueryPlans.json
index 370684a586..ec7b105cb9 100644
--- a/pinot-query-planner/src/test/resources/queries/BasicQueryPlans.json
+++ b/pinot-query-planner/src/test/resources/queries/BasicQueryPlans.json
@@ -37,10 +37,10 @@
         "sql": "EXPLAIN PLAN FOR SELECT dateTrunc('DAY', ts) FROM a LIMIT 10",
         "output": [
           "Execution Plan",
-          "\nLogicalProject(EXPR$0=[DATETRUNC('DAY', $6)])",
-          "\n  LogicalSort(offset=[0], fetch=[10])",
-          "\n    PinotLogicalSortExchange(distribution=[hash], collation=[[]], isSortOnSender=[false], isSortOnReceiver=[false])",
-          "\n      LogicalSort(fetch=[10])",
+          "\nLogicalSort(offset=[0], fetch=[10])",
+          "\n  PinotLogicalSortExchange(distribution=[hash], collation=[[]], isSortOnSender=[false], isSortOnReceiver=[false])",
+          "\n    LogicalSort(fetch=[10])",
+          "\n      LogicalProject(EXPR$0=[DATETRUNC('DAY', $6)])",
           "\n        LogicalTableScan(table=[[a]])",
           "\n"
         ]
@@ -50,10 +50,10 @@
         "sql": "EXPLAIN PLAN FOR SELECT dateTrunc('DAY', ts) AS day FROM a LIMIT 10",
         "output": [
           "Execution Plan",
-          "\nLogicalProject(day=[DATETRUNC('DAY', $6)])",
-          "\n  LogicalSort(offset=[0], fetch=[10])",
-          "\n    PinotLogicalSortExchange(distribution=[hash], collation=[[]], isSortOnSender=[false], isSortOnReceiver=[false])",
-          "\n      LogicalSort(fetch=[10])",
+          "\nLogicalSort(offset=[0], fetch=[10])",
+          "\n  PinotLogicalSortExchange(distribution=[hash], collation=[[]], isSortOnSender=[false], isSortOnReceiver=[false])",
+          "\n    LogicalSort(fetch=[10])",
+          "\n      LogicalProject(day=[DATETRUNC('DAY', $6)])",
           "\n        LogicalTableScan(table=[[a]])",
           "\n"
         ]
diff --git a/pinot-query-planner/src/test/resources/queries/JoinPlans.json b/pinot-query-planner/src/test/resources/queries/JoinPlans.json
index 141e2a2602..37e141d58e 100644
--- a/pinot-query-planner/src/test/resources/queries/JoinPlans.json
+++ b/pinot-query-planner/src/test/resources/queries/JoinPlans.json
@@ -6,10 +6,10 @@
         "sql": "EXPLAIN PLAN FOR SELECT a.col1, a.ts, b.col3 FROM a JOIN b ON a.col1 = b.col2 ORDER BY a.col1",
         "output": [
           "Execution Plan",
-          "\nLogicalProject(col1=[$0], ts=[$1], col3=[$3])",
-          "\n  LogicalSort(sort0=[$0], dir0=[ASC], offset=[0])",
-          "\n    PinotLogicalSortExchange(distribution=[hash], collation=[[0]], isSortOnSender=[false], isSortOnReceiver=[true])",
-          "\n      LogicalSort(sort0=[$0], dir0=[ASC])",
+          "\nLogicalSort(sort0=[$0], dir0=[ASC], offset=[0])",
+          "\n  PinotLogicalSortExchange(distribution=[hash], collation=[[0]], isSortOnSender=[false], isSortOnReceiver=[true])",
+          "\n    LogicalSort(sort0=[$0], dir0=[ASC])",
+          "\n      LogicalProject(col1=[$0], ts=[$1], col3=[$3])",
           "\n        LogicalJoin(condition=[=($0, $2)], joinType=[inner])",
           "\n          PinotLogicalExchange(distribution=[hash[0]])",
           "\n            LogicalProject(col1=[$0], ts=[$6])",
@@ -25,10 +25,10 @@
         "sql": "EXPLAIN PLAN FOR SELECT a.col1 AS value1, a.ts AS ts1, b.col3 FROM a JOIN b ON a.col1 = b.col2 ORDER BY a.col1",
         "output": [
           "Execution Plan",
-          "\nLogicalProject(value1=[$0], ts1=[$1], col3=[$3])",
-          "\n  LogicalSort(sort0=[$0], dir0=[ASC], offset=[0])",
-          "\n    PinotLogicalSortExchange(distribution=[hash], collation=[[0]], isSortOnSender=[false], isSortOnReceiver=[true])",
-          "\n      LogicalSort(sort0=[$0], dir0=[ASC])",
+          "\nLogicalSort(sort0=[$0], dir0=[ASC], offset=[0])",
+          "\n  PinotLogicalSortExchange(distribution=[hash], collation=[[0]], isSortOnSender=[false], isSortOnReceiver=[true])",
+          "\n    LogicalSort(sort0=[$0], dir0=[ASC])",
+          "\n      LogicalProject(value1=[$0], ts1=[$1], col3=[$3])",
           "\n        LogicalJoin(condition=[=($0, $2)], joinType=[inner])",
           "\n          PinotLogicalExchange(distribution=[hash[0]])",
           "\n            LogicalProject(col1=[$0], ts=[$6])",
diff --git a/pinot-query-planner/src/test/resources/queries/OrderByPlans.json b/pinot-query-planner/src/test/resources/queries/OrderByPlans.json
index a6b391ca1c..6c53556c6e 100644
--- a/pinot-query-planner/src/test/resources/queries/OrderByPlans.json
+++ b/pinot-query-planner/src/test/resources/queries/OrderByPlans.json
@@ -6,10 +6,10 @@
         "sql": "EXPLAIN PLAN FOR SELECT a.col1 FROM a ORDER BY a.col1",
         "output": [
           "Execution Plan",
-          "\nLogicalProject(col1=[$0])",
-          "\n  LogicalSort(sort0=[$0], dir0=[ASC], offset=[0])",
-          "\n    PinotLogicalSortExchange(distribution=[hash], collation=[[0]], isSortOnSender=[false], isSortOnReceiver=[true])",
-          "\n      LogicalSort(sort0=[$0], dir0=[ASC])",
+          "\nLogicalSort(sort0=[$0], dir0=[ASC], offset=[0])",
+          "\n  PinotLogicalSortExchange(distribution=[hash], collation=[[0]], isSortOnSender=[false], isSortOnReceiver=[true])",
+          "\n    LogicalSort(sort0=[$0], dir0=[ASC])",
+          "\n      LogicalProject(col1=[$0])",
           "\n        LogicalTableScan(table=[[a]])",
           "\n"
         ]
@@ -19,10 +19,10 @@
         "sql": "EXPLAIN PLAN FOR SELECT a.col1 AS value1 FROM a ORDER BY a.col1",
         "output": [
           "Execution Plan",
-          "\nLogicalProject(value1=[$0])",
-          "\n  LogicalSort(sort0=[$0], dir0=[ASC], offset=[0])",
-          "\n    PinotLogicalSortExchange(distribution=[hash], collation=[[0]], isSortOnSender=[false], isSortOnReceiver=[true])",
-          "\n      LogicalSort(sort0=[$0], dir0=[ASC])",
+          "\nLogicalSort(sort0=[$0], dir0=[ASC], offset=[0])",
+          "\n  PinotLogicalSortExchange(distribution=[hash], collation=[[0]], isSortOnSender=[false], isSortOnReceiver=[true])",
+          "\n    LogicalSort(sort0=[$0], dir0=[ASC])",
+          "\n      LogicalProject(value1=[$0])",
           "\n        LogicalTableScan(table=[[a]])",
           "\n"
         ]


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