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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0ee06f30b02 [feature](nereids)Ignore some node in 'explain shape plan' 
command (#25485)
0ee06f30b02 is described below

commit 0ee06f30b0223ff2d41f9fd8d732fecc3b2a91f9
Author: minghong <engle...@gmail.com>
AuthorDate: Tue Oct 17 11:57:36 2023 +0800

    [feature](nereids)Ignore some node in 'explain shape plan' command (#25485)
    
    if set ignore_shape_nodes='PhysicalDistribute, PhysicalProject'
    then
    explain shape plan will not print project and distribute node
---
 .../org/apache/doris/nereids/trees/plans/Plan.java |  10 +-
 .../java/org/apache/doris/qe/SessionVariable.java  |  15 ++
 .../eliminate_outer_join/eliminate_outer_join.out  | 195 ++++++++-------------
 .../eliminate_outer_join.groovy                    |   4 +-
 4 files changed, 99 insertions(+), 125 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/Plan.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/Plan.java
index 97614321ce3..ec1c752c428 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/Plan.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/Plan.java
@@ -27,6 +27,7 @@ import 
org.apache.doris.nereids.trees.expressions.NamedExpression;
 import org.apache.doris.nereids.trees.expressions.Slot;
 import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
 import org.apache.doris.nereids.util.MutableState;
+import org.apache.doris.qe.ConnectContext;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
@@ -156,8 +157,13 @@ public interface Plan extends TreeNode<Plan> {
      */
     default String shape(String prefix) {
         StringBuilder builder = new StringBuilder();
-        builder.append(prefix).append(shapeInfo()).append("\n");
-        String childPrefix = prefix + "--";
+        String me = shapeInfo();
+        String prefixTail = "";
+        if (! 
ConnectContext.get().getSessionVariable().getIgnoreShapePlanNodes().contains(me))
 {
+            builder.append(prefix).append(shapeInfo()).append("\n");
+            prefixTail += "--";
+        }
+        String childPrefix = prefix + prefixTail;
         children().forEach(
                 child -> {
                     builder.append(child.shape(childPrefix));
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 ee93e969196..4f039079972 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
@@ -1239,6 +1239,21 @@ public class SessionVariable implements Serializable, 
Writable {
             description = {"是否启用更快的浮点数转换算法,注意会影响输出格式", "Set true to enable 
faster float pointer number convert"})
     public boolean fasterFloatConvert = false;
 
+    public static final String IGNORE_SHAPE_NODE = "ignore_shape_nodes";
+
+    public Set<String> getIgnoreShapePlanNodes() {
+        return 
Arrays.stream(ignoreShapePlanNodes.split(",[\\s]*")).collect(ImmutableSet.toImmutableSet());
+    }
+
+    public void setIgnoreShapePlanNodes(String ignoreShapePlanNodes) {
+        this.ignoreShapePlanNodes = ignoreShapePlanNodes;
+    }
+
+    @VariableMgr.VarAttr(name = IGNORE_SHAPE_NODE,
+            description = {"'explain shape plan' 命令中忽略的PlanNode 类型",
+                    "the plan node type which is ignored in 'explain shape 
plan' command"})
+    public String ignoreShapePlanNodes = "";
+
     // If this fe is in fuzzy mode, then will use initFuzzyModeVariables to 
generate some variables,
     // not the default value set in the code.
     public void initFuzzyModeVariables() {
diff --git 
a/regression-test/data/nereids_p0/eliminate_outer_join/eliminate_outer_join.out 
b/regression-test/data/nereids_p0/eliminate_outer_join/eliminate_outer_join.out
index 4b0653f8993..a5fe3687d1a 100644
--- 
a/regression-test/data/nereids_p0/eliminate_outer_join/eliminate_outer_join.out
+++ 
b/regression-test/data/nereids_p0/eliminate_outer_join/eliminate_outer_join.out
@@ -1,150 +1,101 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !1 --
 PhysicalResultSink
---PhysicalDistribute
-----PhysicalProject
-------hashJoin[INNER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
---------hashJoin[INNER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
-----------hashJoin[INNER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
-------------PhysicalOlapScan[region]
-------------PhysicalDistribute
---------------filter(( not n_nationkey IS NULL) and (nation.n_nationkey > 1))
-----------------PhysicalOlapScan[nation]
-----------PhysicalDistribute
-------------filter(( not s_suppkey IS NULL) and (supplier.s_suppkey > 1))
---------------PhysicalOlapScan[supplier]
---------PhysicalDistribute
-----------filter(( not ps_suppkey IS NULL) and (partsupp.ps_suppkey > 1))
-------------PhysicalOlapScan[partsupp]
+--hashJoin[INNER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
+----hashJoin[INNER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
+------hashJoin[INNER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
+--------PhysicalOlapScan[region]
+--------filter(( not n_nationkey IS NULL) and (nation.n_nationkey > 1))
+----------PhysicalOlapScan[nation]
+------filter(( not s_suppkey IS NULL) and (supplier.s_suppkey > 1))
+--------PhysicalOlapScan[supplier]
+----filter(( not ps_suppkey IS NULL) and (partsupp.ps_suppkey > 1))
+------PhysicalOlapScan[partsupp]
 
 -- !2 --
 PhysicalResultSink
---PhysicalDistribute
-----PhysicalProject
-------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
---------PhysicalDistribute
-----------filter((supplier.s_suppkey > 1))
-------------hashJoin[FULL_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
---------------PhysicalDistribute
-----------------hashJoin[FULL_OUTER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
-------------------PhysicalDistribute
---------------------PhysicalOlapScan[region]
-------------------PhysicalDistribute
---------------------PhysicalOlapScan[nation]
---------------PhysicalDistribute
-----------------PhysicalOlapScan[supplier]
---------PhysicalDistribute
-----------filter(( not ps_suppkey IS NULL) and (partsupp.ps_suppkey > 1))
-------------PhysicalOlapScan[partsupp]
+--hashJoin[RIGHT_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
+----filter((supplier.s_suppkey > 1))
+------hashJoin[FULL_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
+--------hashJoin[FULL_OUTER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
+----------PhysicalOlapScan[region]
+----------PhysicalOlapScan[nation]
+--------PhysicalOlapScan[supplier]
+----filter(( not ps_suppkey IS NULL) and (partsupp.ps_suppkey > 1))
+------PhysicalOlapScan[partsupp]
 
 -- !3 --
 PhysicalResultSink
---PhysicalDistribute
-----PhysicalProject
-------hashJoin[RIGHT_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
---------PhysicalDistribute
-----------filter((supplier.s_suppkey > 1))
-------------hashJoin[LEFT_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
---------------hashJoin[FULL_OUTER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
-----------------PhysicalDistribute
-------------------PhysicalOlapScan[region]
-----------------PhysicalDistribute
-------------------PhysicalOlapScan[nation]
---------------PhysicalDistribute
-----------------PhysicalOlapScan[supplier]
---------PhysicalDistribute
-----------filter(( not ps_suppkey IS NULL) and (partsupp.ps_suppkey > 1))
-------------PhysicalOlapScan[partsupp]
+--hashJoin[RIGHT_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
+----filter((supplier.s_suppkey > 1))
+------hashJoin[LEFT_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
+--------hashJoin[FULL_OUTER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
+----------PhysicalOlapScan[region]
+----------PhysicalOlapScan[nation]
+--------PhysicalOlapScan[supplier]
+----filter(( not ps_suppkey IS NULL) and (partsupp.ps_suppkey > 1))
+------PhysicalOlapScan[partsupp]
 
 -- !4 --
 PhysicalResultSink
---PhysicalDistribute
-----PhysicalProject
-------hashJoin[LEFT_OUTER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
---------filter(( not r_name IS NULL) and (region.r_name = ''))
-----------PhysicalOlapScan[region]
---------PhysicalDistribute
-----------PhysicalOlapScan[nation]
+--hashJoin[LEFT_OUTER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
+----filter(( not r_name IS NULL) and (region.r_name = ''))
+------PhysicalOlapScan[region]
+----PhysicalOlapScan[nation]
 
 -- !5 --
 PhysicalResultSink
---PhysicalDistribute
-----PhysicalProject
-------hashJoin[LEFT_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
---------hashJoin[LEFT_OUTER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
-----------filter(( not r_name IS NULL) and (region.r_name = ''))
-------------PhysicalOlapScan[region]
-----------PhysicalDistribute
-------------PhysicalOlapScan[nation]
---------PhysicalDistribute
-----------PhysicalOlapScan[supplier]
+--hashJoin[LEFT_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
+----hashJoin[LEFT_OUTER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
+------filter(( not r_name IS NULL) and (region.r_name = ''))
+--------PhysicalOlapScan[region]
+------PhysicalOlapScan[nation]
+----PhysicalOlapScan[supplier]
 
 -- !6 --
 PhysicalResultSink
---PhysicalDistribute
-----PhysicalProject
-------hashJoin[LEFT_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
---------hashJoin[LEFT_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
-----------hashJoin[LEFT_OUTER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
-------------filter(( not r_name IS NULL) and (region.r_name = ''))
---------------PhysicalOlapScan[region]
-------------PhysicalDistribute
---------------PhysicalOlapScan[nation]
-----------PhysicalDistribute
-------------PhysicalOlapScan[supplier]
---------PhysicalDistribute
-----------PhysicalOlapScan[partsupp]
+--hashJoin[LEFT_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
+----hashJoin[LEFT_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
+------hashJoin[LEFT_OUTER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
+--------filter(( not r_name IS NULL) and (region.r_name = ''))
+----------PhysicalOlapScan[region]
+--------PhysicalOlapScan[nation]
+------PhysicalOlapScan[supplier]
+----PhysicalOlapScan[partsupp]
 
 -- !7 --
 PhysicalResultSink
---PhysicalDistribute
-----PhysicalProject
-------hashJoin[FULL_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
---------PhysicalDistribute
-----------hashJoin[LEFT_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
-------------hashJoin[INNER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
---------------filter(( not r_regionkey IS NULL))
-----------------PhysicalOlapScan[region]
---------------PhysicalDistribute
-----------------filter(( not n_regionkey IS NULL))
-------------------PhysicalOlapScan[nation]
-------------PhysicalDistribute
---------------PhysicalOlapScan[supplier]
---------PhysicalDistribute
-----------PhysicalOlapScan[partsupp]
+--hashJoin[FULL_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
+----hashJoin[LEFT_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
+------hashJoin[INNER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
+--------filter(( not r_regionkey IS NULL))
+----------PhysicalOlapScan[region]
+--------filter(( not n_regionkey IS NULL))
+----------PhysicalOlapScan[nation]
+------PhysicalOlapScan[supplier]
+----PhysicalOlapScan[partsupp]
 
 -- !8 --
 PhysicalResultSink
---PhysicalDistribute
-----PhysicalProject
-------hashJoin[LEFT_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
---------hashJoin[LEFT_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
-----------hashJoin[INNER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
-------------PhysicalDistribute
---------------filter(( not r_name IS NULL) and ( not r_regionkey IS NULL) and 
(region.r_name = ''))
-----------------PhysicalOlapScan[region]
-------------PhysicalDistribute
---------------filter(( not n_regionkey IS NULL))
-----------------PhysicalOlapScan[nation]
-----------PhysicalDistribute
-------------PhysicalOlapScan[supplier]
---------PhysicalDistribute
-----------PhysicalOlapScan[partsupp]
+--hashJoin[LEFT_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
+----hashJoin[LEFT_OUTER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
+------hashJoin[INNER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
+--------filter(( not r_name IS NULL) and ( not r_regionkey IS NULL) and 
(region.r_name = ''))
+----------PhysicalOlapScan[region]
+--------filter(( not n_regionkey IS NULL))
+----------PhysicalOlapScan[nation]
+------PhysicalOlapScan[supplier]
+----PhysicalOlapScan[partsupp]
 
 -- !9 --
 PhysicalResultSink
---PhysicalDistribute
-----PhysicalProject
-------hashJoin[LEFT_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
---------hashJoin[INNER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
-----------hashJoin[INNER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
-------------filter(( not r_name IS NULL) and ( not r_regionkey IS NULL) and 
(region.r_name = ''))
---------------PhysicalOlapScan[region]
-------------PhysicalDistribute
---------------filter(( not n_regionkey IS NULL))
-----------------PhysicalOlapScan[nation]
-----------PhysicalDistribute
-------------PhysicalOlapScan[supplier]
---------PhysicalDistribute
-----------PhysicalOlapScan[partsupp]
+--hashJoin[LEFT_OUTER_JOIN] hashCondition=((partsupp.ps_suppkey = 
supplier.s_suppkey))otherCondition=()
+----hashJoin[INNER_JOIN] hashCondition=((nation.n_nationkey = 
supplier.s_suppkey))otherCondition=()
+------hashJoin[INNER_JOIN] hashCondition=((region.r_regionkey = 
nation.n_regionkey))otherCondition=()
+--------filter(( not r_name IS NULL) and ( not r_regionkey IS NULL) and 
(region.r_name = ''))
+----------PhysicalOlapScan[region]
+--------filter(( not n_regionkey IS NULL))
+----------PhysicalOlapScan[nation]
+------PhysicalOlapScan[supplier]
+----PhysicalOlapScan[partsupp]
 
diff --git 
a/regression-test/suites/nereids_p0/eliminate_outer_join/eliminate_outer_join.groovy
 
b/regression-test/suites/nereids_p0/eliminate_outer_join/eliminate_outer_join.groovy
index d91d506ccbd..8fca1676497 100644
--- 
a/regression-test/suites/nereids_p0/eliminate_outer_join/eliminate_outer_join.groovy
+++ 
b/regression-test/suites/nereids_p0/eliminate_outer_join/eliminate_outer_join.groovy
@@ -22,7 +22,9 @@ suite("eliminate_outer_join") {
     sql "set disable_join_reorder=true"
     sql "set forbid_unknown_col_stats=false"
     sql "set enable_bucket_shuffle_join=false"
-    
+    sql """
+    set ignore_shape_nodes='PhysicalDistribute, PhysicalProject'
+    """
     String database = context.config.getDbNameByFile(context.file)
     sql "drop database if exists ${database}"
     sql "create database ${database}"


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

Reply via email to