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

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new cf45f086735 [fix](planner)should always use plan node's getTblRefIds 
method to get unassigned conjuncts for this node (#25130) (#31015)
cf45f086735 is described below

commit cf45f086735673a9da40736739fdb807f2a62367
Author: Mingyu Chen <[email protected]>
AuthorDate: Fri Feb 9 17:42:55 2024 +0800

    [fix](planner)should always use plan node's getTblRefIds method to get 
unassigned conjuncts for this node (#25130) (#31015)
    
    bp #25130
    Co-authored-by: starocean999 
<[email protected]>
---
 .../java/org/apache/doris/analysis/Analyzer.java   |  9 +++---
 .../org/apache/doris/planner/QueryPlanTest.java    |  2 +-
 .../test_push_conjuncts_inlineview.groovy          | 34 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
index 0f09985cabc..ebceacedf3f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Analyzer.java
@@ -44,6 +44,7 @@ import org.apache.doris.common.util.VectorizedUtil;
 import org.apache.doris.external.hudi.HudiTable;
 import org.apache.doris.external.hudi.HudiUtils;
 import org.apache.doris.planner.AggregationNode;
+import org.apache.doris.planner.AnalyticEvalNode;
 import org.apache.doris.planner.PlanNode;
 import org.apache.doris.planner.RuntimeFilter;
 import org.apache.doris.qe.ConnectContext;
@@ -2461,12 +2462,12 @@ public class Analyzer {
      * Wrapper around getUnassignedConjuncts(List<TupleId> tupleIds).
      */
     public List<Expr> getUnassignedConjuncts(PlanNode node) {
-        // constant conjuncts should be push down to all leaf node except agg 
node.
+        // constant conjuncts should be push down to all leaf node except agg 
and analytic node.
         // (see getPredicatesBoundedByGroupbysSourceExpr method)
         // so we need remove constant conjuncts when expr is not a leaf node.
-        List<Expr> unassigned = getUnassignedConjuncts(
-                node instanceof AggregationNode ? node.getTupleIds() : 
node.getTblRefIds());
-        if (!node.getChildren().isEmpty() && !(node instanceof 
AggregationNode)) {
+        List<Expr> unassigned = getUnassignedConjuncts(node.getTblRefIds());
+        if (!node.getChildren().isEmpty()
+                && !(node instanceof AggregationNode || node instanceof 
AnalyticEvalNode)) {
             unassigned = unassigned.stream()
                     .filter(e -> !e.isConstant()).collect(Collectors.toList());
         }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
index f9bcb0bbd06..ce58afd035e 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/planner/QueryPlanTest.java
@@ -1920,7 +1920,7 @@ public class QueryPlanTest extends TestWithFeService {
         String sql = "select * from issue7929.t1 left join (select max(j1) 
over() as x from issue7929.t2) a"
                 + " on t1.k1 = a.x where 1 = 0;";
         String explainStr = getSQLPlanOrErrorMsg(sql, true);
-        Assert.assertTrue(UtFrameUtils.checkPlanResultContainsNode(explainStr, 
4, "EMPTYSET"));
+        Assert.assertTrue(UtFrameUtils.checkPlanResultContainsNode(explainStr, 
5, "EMPTYSET"));
         Assert.assertTrue(explainStr.contains("tuple ids: 5"));
     }
 
diff --git 
a/regression-test/suites/correctness_p0/test_push_conjuncts_inlineview.groovy 
b/regression-test/suites/correctness_p0/test_push_conjuncts_inlineview.groovy
index 1276b58807d..29663c702df 100644
--- 
a/regression-test/suites/correctness_p0/test_push_conjuncts_inlineview.groovy
+++ 
b/regression-test/suites/correctness_p0/test_push_conjuncts_inlineview.groovy
@@ -151,5 +151,39 @@ explain {
     }
 
  sql """ DROP TABLE IF EXISTS `push_conjunct_table` """
+
+    sql """ DROP TABLE IF EXISTS `dwd_mf_wms_plate_table` """
+    sql """ CREATE TABLE `dwd_mf_wms_plate_table` (
+            `id` int(11) NOT NULL COMMENT '主键',
+            `length` float NOT NULL COMMENT '',
+            `created_time` datetime NULL COMMENT '创建时间'
+            ) ENGINE=OLAP
+            UNIQUE KEY(`id`)
+            COMMENT ''
+            DISTRIBUTED BY HASH(`id`) BUCKETS 1
+            PROPERTIES (
+            "replication_allocation" = "tag.location.default: 1"
+            );"""
+    explain {
+            sql("""select created_time from(
+                        select 
+                        ROW_NUMBER() over(order by id ) as row_num,
+                        id,
+                        length,
+                        created_time
+                        from(
+                        select
+                        id,
+                        `length` ,
+                        created_time
+                        from
+                        dwd_mf_wms_plate_table
+                        ) t
+                        group by id,length,created_time
+                        ) res 
+                        where res.created_time<'2022-02-18 09:30:13';""")
+            contains "VSELECT"
+        }
+    sql """ DROP TABLE IF EXISTS `dwd_mf_wms_plate_table` """
 }
 


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

Reply via email to