You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by kx...@apache.org on 2023/10/11 16:55:57 UTC
[doris] 40/47: [fix](planner)should always use plan node's getTblRefIds method to get unassigned conjuncts for this node (#25130)
This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 7ff5a4c0e192de7d323dc60b953672c134a80630
Author: starocean999 <40...@users.noreply.github.com>
AuthorDate: Wed Oct 11 16:34:21 2023 +0800
[fix](planner)should always use plan node's getTblRefIds method to get unassigned conjuncts for this node (#25130)
---
.../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 f0e96665096..37a1fa0c539 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
@@ -41,6 +41,7 @@ import org.apache.doris.common.IdGenerator;
import org.apache.doris.common.Pair;
import org.apache.doris.common.util.TimeUtils;
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;
@@ -2457,12 +2458,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 e49bb00ab57..9c4b269110d 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
@@ -1928,7 +1928,7 @@ public class QueryPlanTest extends TestWithFeService {
String sql = "select /*+ SET_VAR(enable_nereids_planner=false) */ * 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: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org