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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 24c32944f12  [feat](nereids) add session var to turn on/off common sub 
expressoin extraction (branch-2.1) #33616
24c32944f12 is described below

commit 24c32944f1265064dea70e5a60f476e9de1a18d1
Author: minghong <engle...@gmail.com>
AuthorDate: Sat Apr 13 14:10:46 2024 +0800

     [feat](nereids) add session var to turn on/off common sub expressoin 
extraction (branch-2.1) #33616
---
 .../org/apache/doris/nereids/processor/post/PlanPostProcessors.java   | 4 +++-
 fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java     | 4 ++++
 regression-test/suites/tpch_sf0.1_p1/sql/cse.groovy                   | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PlanPostProcessors.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PlanPostProcessors.java
index 86c8486ef45..e0cc791f859 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PlanPostProcessors.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PlanPostProcessors.java
@@ -63,7 +63,9 @@ public class PlanPostProcessors {
         builder.add(new MergeProjectPostProcessor());
         builder.add(new RecomputeLogicalPropertiesProcessor());
         builder.add(new AddOffsetIntoDistribute());
-        builder.add(new CommonSubExpressionOpt());
+        if 
(cascadesContext.getConnectContext().getSessionVariable().enableCommonSubExpression)
 {
+            builder.add(new CommonSubExpressionOpt());
+        }
         // DO NOT replace PLAN NODE from here
         builder.add(new TopNScanOpt());
         builder.add(new FragmentProcessor());
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index ca814c494c1..fb0d8a42237 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -908,6 +908,10 @@ public class SessionVariable implements Serializable, 
Writable {
             varType = VariableAnnotation.EXPERIMENTAL, needForward = true)
     private int parallelScanMaxScannersCount = 48;
 
+    @VariableMgr.VarAttr(name = "enable_common_sub_expression", fuzzy = false,
+            varType = VariableAnnotation.EXPERIMENTAL, needForward = true)
+    public boolean enableCommonSubExpression = false;
+
     @VariableMgr.VarAttr(name = PARALLEL_SCAN_MIN_ROWS_PER_SCANNER, fuzzy = 
true,
             varType = VariableAnnotation.EXPERIMENTAL, needForward = true)
     private long parallelScanMinRowsPerScanner = 16384; // 16K
diff --git a/regression-test/suites/tpch_sf0.1_p1/sql/cse.groovy 
b/regression-test/suites/tpch_sf0.1_p1/sql/cse.groovy
index d5989cf68b8..c4c1ecb2e63 100644
--- a/regression-test/suites/tpch_sf0.1_p1/sql/cse.groovy
+++ b/regression-test/suites/tpch_sf0.1_p1/sql/cse.groovy
@@ -20,6 +20,7 @@
 // and modified by Doris.
 
 suite('cse') {
+    sql "set enable_common_sub_expression=true"
     def q1 = """select s_suppkey,n_regionkey,(s_suppkey + n_regionkey) + 1 as 
x, (s_suppkey + n_regionkey) + 2 as y 
             from supplier join nation on s_nationkey=n_nationkey order by 
s_suppkey , n_regionkey limit 10 ;
             """


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

Reply via email to