Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,15 @@ public List<Rule> buildRules() {
ctx.statementContext, shouldOutputMarkJoinSlot.get(i));
SubqueryContext context = new SubqueryContext(subqueryExprs);
Expression conjunct = replaceSubquery.replace(oldConjuncts.get(i), context);
/*
* the idea is replacing each mark join slot with null and false literal
* then run FoldConstant rule, if the evaluate result are:
* 1. all true
* 2. all null and false (in logicalFilter, we discard both null and false values)
* the mark slot can be non-nullable boolean
* we pass this info to LogicalApply. And in InApplyToJoin rule
* if it's semi join with non-null mark slot
* we can safely change the mark conjunct to hash conjunct
*/
ExpressionRewriteContext rewriteContext = new ExpressionRewriteContext(ctx.cascadesContext);
boolean isMarkSlotNotNull = conjunct.containsType(MarkJoinSlotReference.class)
? ExpressionUtils.canInferNotNullForMarkSlot(
TrySimplifyPredicateWithMarkJoinSlot.INSTANCE.rewrite(conjunct,
rewriteContext), rewriteContext)
: false;
// TODO: The way to optimize null aware mark join is not right.
// remove it temporary until we refactor it.
// ExpressionRewriteContext rewriteContext = new ExpressionRewriteContext(ctx.cascadesContext);
// boolean isMarkSlotNotNull = conjunct.containsType(MarkJoinSlotReference.class)
// ? ExpressionUtils.canInferNotNullForMarkSlot(
// TrySimplifyPredicateWithMarkJoinSlot.INSTANCE.rewrite(conjunct,
// rewriteContext), rewriteContext)
// : false;
boolean isMarkSlotNotNull = false;
Pair<LogicalPlan, Optional<Expression>> result = subqueryToApply(subqueryExprs.stream()
.collect(ImmutableList.toImmutableList()), tmpPlan,
context.getSubqueryToMarkJoinSlot(),
Expand Down
Loading