[fix](Nereids) can't choosing best plan for join that could only broadcast (#25511)
we need ensure there is one request properties at least
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user