Skip to content

Commit 7a76b40

Browse files
committed
planner: skip PushDownNot when no outer NOT
1 parent 00c2562 commit 7a76b40

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

pkg/planner/core/operator/logicalop/logical_join.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,22 +274,13 @@ func (p *LogicalJoin) normalizeJoinConditionsForOuterJoin() {
274274
}
275275
// Outer join ON conditions are not simplified through predicate pushdown.
276276
// Normalize only double NOT here to avoid cartesian joins caused by other conditions.
277-
if !containsUnaryNot(p.OtherConditions) {
278-
return
279-
}
280277
exprCtx := p.SCtx().GetExprCtx()
281278
for i := range p.OtherConditions {
282-
p.OtherConditions[i] = expression.PushDownNot(exprCtx, p.OtherConditions[i])
283-
}
284-
}
285-
286-
func containsUnaryNot(conds []expression.Expression) bool {
287-
for _, cond := range conds {
288-
if expression.ContainOuterNot(cond) {
289-
return true
279+
if !expression.ContainOuterNot(p.OtherConditions[i]) {
280+
continue
290281
}
282+
p.OtherConditions[i] = expression.PushDownNot(exprCtx, p.OtherConditions[i])
291283
}
292-
return false
293284
}
294285

295286
// simplifyOuterJoin transforms "LeftOuterJoin/RightOuterJoin" to "InnerJoin" if possible.

0 commit comments

Comments
 (0)