[fix](nereids) disable PROJECT_OTHER_JOIN_CONDITION rule if bitmap filter is enabled. #34189

this pr is a quick solution, but not complete.
runtime filter on NestLoopJoin suffers this bug even without PROJECT_OTHER_JOIN_CONDITION rule.

for example, when enable Min_Max Runtime filter, the target Expression is n_regionkey, but it should be "n_regionkey - 28"
explain
select n_nationkey, nrkey
from (select n_regionkey -28 nrkey, n_nationkey from nation) T
join region on nrkey > r_regionkey;

we will refactor RuntimeFilterGenerator to completely solve this issue in following pr.
This commit is contained in:
minghong
2024-04-28 15:33:22 +08:00
committed by yiguolei
parent 74029f56d4
commit 8f40882701
3 changed files with 54 additions and 51 deletions

View File

@ -26,6 +26,8 @@ import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.expressions.visitor.DefaultExpressionRewriter;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.logical.LogicalProject;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.thrift.TRuntimeFilterType;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
@ -49,12 +51,14 @@ import java.util.Set;
public class ProjectOtherJoinConditionForNestedLoopJoin extends OneRewriteRuleFactory {
@Override
public Rule build() {
return logicalJoin().when(
join -> join.getHashJoinConjuncts().isEmpty()
return logicalJoin()
.when(join -> join.getHashJoinConjuncts().isEmpty()
&& !join.isMarkJoin()
&& !join.getOtherJoinConjuncts().isEmpty()
).then(
join -> {
&& !join.getOtherJoinConjuncts().isEmpty())
.whenNot(join -> ConnectContext.get() != null
&& ConnectContext.get().getSessionVariable()
.allowedRuntimeFilterType(TRuntimeFilterType.BITMAP))
.then(join -> {
List<Expression> otherConjuncts = join.getOtherJoinConjuncts();
List<Expression> newOtherConjuncts = new ArrayList<>();
Set<Slot> leftSlots = join.child(0).getOutputSet();

View File

@ -2561,6 +2561,10 @@ public class SessionVariable implements Serializable, Writable {
return runtimeFilterType;
}
public boolean allowedRuntimeFilterType(TRuntimeFilterType type) {
return (runtimeFilterType & type.getValue()) != 0;
}
public boolean isRuntimeFilterTypeEnabled(TRuntimeFilterType type) {
return (runtimeFilterType & type.getValue()) == type.getValue();
}