From d065449da72633d839394a937d47a4045e3a0752 Mon Sep 17 00:00:00 2001 From: wshwsh12 <793703860@qq.com> Date: Wed, 14 Apr 2021 15:37:56 +0800 Subject: [PATCH] address comments --- expression/constant_propagation.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/expression/constant_propagation.go b/expression/constant_propagation.go index 0c2e22ef645ec..19906023b07be 100644 --- a/expression/constant_propagation.go +++ b/expression/constant_propagation.go @@ -533,6 +533,9 @@ func (s *propOuterJoinConstSolver) deriveConds(outerCol, innerCol *Column, schem // 'expression(..., outerCol, ...)' does not reference columns outside children schemas of join node. // Derived new expressions must be appended into join condition, not filter condition. func (s *propOuterJoinConstSolver) propagateColumnEQ() { + if s.nullSensitive { + return + } visited := make([]bool, 2*len(s.joinConds)+len(s.filterConds)) s.unionSet = disjointset.NewIntSet(len(s.columns)) var outerCol, innerCol *Column @@ -553,9 +556,6 @@ func (s *propOuterJoinConstSolver) propagateColumnEQ() { // `select *, t1.a in (select t2.b from t t2) from t t1` // rows with t2.b is null would impact whether LeftOuterSemiJoin should output 0 or null if there // is no row satisfying t2.b = t1.a - if s.nullSensitive { - continue - } childCol := s.innerSchema.RetrieveColumn(innerCol) if !mysql.HasNotNullFlag(childCol.RetType.Flag) { notNullExpr := BuildNotNullExpr(s.ctx, childCol) @@ -576,9 +576,7 @@ func (s *propOuterJoinConstSolver) propagateColumnEQ() { if outerCol == nil { continue } - if !s.nullSensitive { - visited = s.deriveConds(outerCol, innerCol, mergedSchema, lenJoinConds, visited, false) - } + visited = s.deriveConds(outerCol, innerCol, mergedSchema, lenJoinConds, visited, false) visited = s.deriveConds(outerCol, innerCol, mergedSchema, lenJoinConds, visited, true) } }