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 6f6264693ff [fix](Nereids) can't choosing best plan for join that
could only broadcast (#25511)
6f6264693ff is described below
commit 6f6264693ffc84d020ef60ea606e963edcf39b5d
Author: 谢健 <[email protected]>
AuthorDate: Wed Oct 18 10:40:05 2023 +0800
[fix](Nereids) can't choosing best plan for join that could only broadcast
(#25511)
we need ensure there is one request properties at least
---
.../doris/nereids/properties/RequestPropertyDeriver.java | 8 ++------
.../main/java/org/apache/doris/nereids/util/JoinUtils.java | 13 +++++++++++++
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/RequestPropertyDeriver.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/RequestPropertyDeriver.java
index acc8ef78867..7d9f8f994e3 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/RequestPropertyDeriver.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/properties/RequestPropertyDeriver.java
@@ -167,12 +167,8 @@ public class RequestPropertyDeriver extends
PlanVisitor<Void, PlanContext> {
}
// for broadcast join
- double memLimit =
ConnectContext.get().getSessionVariable().getMaxExecMemByte();
- double rowsLimit =
ConnectContext.get().getSessionVariable().getBroadcastRowCountLimit();
- double brMemlimit =
ConnectContext.get().getSessionVariable().getBroadcastHashtableMemLimitPercentage();
- double datasize =
hashJoin.getGroupExpression().get().child(1).getStatistics().computeSize();
- double rowCount =
hashJoin.getGroupExpression().get().child(1).getStatistics().getRowCount();
- if (JoinUtils.couldBroadcast(hashJoin) && rowCount <= rowsLimit &&
datasize <= memLimit * brMemlimit) {
+ if (JoinUtils.couldBroadcast(hashJoin)
+ && (JoinUtils.checkBroadcastJoinStats(hashJoin) ||
requestPropertyToChildren.isEmpty())) {
addBroadcastJoinRequestProperty();
}
return null;
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java
index b9e61e256bf..d1fb973dd61 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java
@@ -35,6 +35,7 @@ import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.algebra.Join;
import org.apache.doris.nereids.trees.plans.physical.AbstractPhysicalJoin;
import org.apache.doris.nereids.trees.plans.physical.PhysicalDistribute;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalHashJoin;
import org.apache.doris.nereids.trees.plans.physical.PhysicalPlan;
import org.apache.doris.qe.ConnectContext;
@@ -61,6 +62,18 @@ public class JoinUtils {
return !(join.getJoinType().isRightJoin() ||
join.getJoinType().isFullOuterJoin());
}
+ /**
+ * check if the row count of the left child in the broadcast join is less
than a threshold value.
+ */
+ public static boolean checkBroadcastJoinStats(PhysicalHashJoin<? extends
Plan, ? extends Plan> join) {
+ double memLimit =
ConnectContext.get().getSessionVariable().getMaxExecMemByte();
+ double rowsLimit =
ConnectContext.get().getSessionVariable().getBroadcastRowCountLimit();
+ double brMemlimit =
ConnectContext.get().getSessionVariable().getBroadcastHashtableMemLimitPercentage();
+ double datasize =
join.getGroupExpression().get().child(1).getStatistics().computeSize();
+ double rowCount =
join.getGroupExpression().get().child(1).getStatistics().getRowCount();
+ return rowCount <= rowsLimit && datasize <= memLimit * brMemlimit;
+ }
+
/**
* for a given equation, judge if it can be used as hash join condition
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]