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 3973571bf17 [opt](nereids)do not apply CSE(Common Sub Expression) upon
multiDataSink (#33746)
3973571bf17 is described below
commit 3973571bf177b8a4aee876c0244b16ff54d24881
Author: minghong <[email protected]>
AuthorDate: Fri Apr 19 08:43:48 2024 +0800
[opt](nereids)do not apply CSE(Common Sub Expression) upon multiDataSink
(#33746)
---
.../doris/nereids/glue/translator/PhysicalPlanTranslator.java | 3 ++-
.../src/main/java/org/apache/doris/planner/RuntimeFilter.java | 2 +-
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java | 1 +
regression-test/suites/tpch_sf0.1_p1/sql/cse.groovy | 10 ++++++++++
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
index 51ef8e72154..98bc581fe8c 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java
@@ -1824,7 +1824,8 @@ public class PhysicalPlanTranslator extends
DefaultPlanVisitor<PlanFragment, Pla
List<Expr> projectionExprs = null;
List<Expr> allProjectionExprs = Lists.newArrayList();
List<Slot> slots = null;
- if (project.hasMultiLayerProjection()) {
+ // TODO FE/BE do not support multi-layer-project on MultiDataSink now.
+ if (project.hasMultiLayerProjection() && !(inputFragment instanceof
MultiCastPlanFragment)) {
int layerCount = project.getMultiLayerProjects().size();
for (int i = 0; i < layerCount; i++) {
List<NamedExpression> layer =
project.getMultiLayerProjects().get(i);
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilter.java
b/fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilter.java
index 7decc5c2baa..ad40367318a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilter.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilter.java
@@ -674,7 +674,7 @@ public final class RuntimeFilter {
* Assigns this runtime filter to the corresponding plan nodes.
*/
public void assignToPlanNodes() {
- Preconditions.checkState(hasTargets());
+ Preconditions.checkState(hasTargets(), this.toString() + " has no
target");
builderNode.addRuntimeFilter(this);
builderNode.fragment.setBuilderRuntimeFilterIds(getFilterId());
for (RuntimeFilterTarget target : targets) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index fdc75ebf7bd..d8db664c14e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -754,6 +754,7 @@ public class StmtExecutor {
if (LOG.isDebugEnabled()) {
LOG.debug("Nereids plan query failed:\n{}",
originStmt.originStmt);
}
+ LOG.info("NereidsException", e);
throw new NereidsException(new
AnalysisException(e.getMessage(), e));
}
profile.getSummaryProfile().setQueryPlanFinishTime();
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..f5637f1e80e 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,9 @@
// and modified by Doris.
suite('cse') {
+ sql "set enable_nereids_planner=true;"
+ sql "set enable_fallback_to_original_planner=false;"
+
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 ;
"""
@@ -51,4 +54,11 @@ suite('cse') {
qt_cse_5 """select (case r_regionkey when 1 then 0 when 2 then 1 else
r_regionkey+1 END) + 1 As x,
(case r_regionkey when 1 then 0 when 2 then 3 else
r_regionkey+1 END) + 2 as y
from region order by x, y;"""
+
+ // do not apply cse upon multiDataSink
+ explain {
+ sql "select * FROM nation left outer join region on n_nationkey-5
= r_regionkey or n_nationkey-10=r_regionkey + 10;"
+ contains("MultiCastDataSinks")
+ notContains("intermediate projections")
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]