This is an automated email from the ASF dual-hosted git repository.
morrysnow 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 f3ef6a54662 [fix](hint) fix leading when use dphyper (#48756)
f3ef6a54662 is described below
commit f3ef6a546622bb7a5b3ec8825c0fa6ea9d04d433
Author: feiniaofeiafei <[email protected]>
AuthorDate: Tue Jul 8 16:59:26 2025 +0800
[fix](hint) fix leading when use dphyper (#48756)
### What problem does this PR solve?
Problem Summary:
use test_multi_leading;
set enable_dphyp_optimizer=true;
explain physical plan
select
count(*)
from
(
select
/*+ leading(alias2 t1) */
c1,
c11
from
t1
join (
select
c2,
c22
from
t2
join t4 on
c2 = c4) as alias2 on
c1 = alias2.c2) as alias1
join t3 on
alias1.c1 = t3.c3;
The leading hint in subquery is not used, because in dphyper, the join
is reordered.
This pr fix this problem.
---
.../org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java | 3 ++-
regression-test/suites/nereids_p0/hint/multi_leading.groovy | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java
index ee8e7553552..166809c0f09 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/HyperGraph.java
@@ -211,7 +211,8 @@ public class HyperGraph {
LogicalJoin<?, ?> join = (LogicalJoin<?, ?>) plan;
return join.getJoinType() == JoinType.INNER_JOIN
&& !join.isMarkJoin()
- && !join.getExpressions().isEmpty();
+ && !join.getExpressions().isEmpty()
+ && !join.isLeadingJoin();
}
/**
diff --git a/regression-test/suites/nereids_p0/hint/multi_leading.groovy
b/regression-test/suites/nereids_p0/hint/multi_leading.groovy
index 1b7479fdd58..2cc43122115 100644
--- a/regression-test/suites/nereids_p0/hint/multi_leading.groovy
+++ b/regression-test/suites/nereids_p0/hint/multi_leading.groovy
@@ -33,6 +33,7 @@ suite("multi_leading") {
sql "set ignore_shape_nodes='PhysicalProject'"
sql 'set enable_fallback_to_original_planner=false'
sql 'set runtime_filter_mode=OFF'
+ sql 'set enable_dphyp_optimizer=true;'
// create tables
sql """drop table if exists t1;"""
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]