Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
  • Loading branch information
hawkingrei committed Jan 12, 2023
1 parent 1f6764e commit 45e648f
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1736,19 +1736,6 @@ func (b *PlanBuilder) buildSemiJoinForSetOperator(
if err != nil {
return nil, err
}
isAllColumn := func(leftOriginPlan LogicalPlan) []bool {
lp, ok := leftOriginPlan.(*LogicalProjection)
if ok {
result := make([]bool, 0, len(lp.Exprs))
for _, expr := range lp.Exprs {
_, ok := expr.(*expression.Column)
result = append(result, ok)
}
return result
}
return nil
}
leftIsColumnList := isAllColumn(leftOriginPlan)
joinPlan := LogicalJoin{JoinType: joinType}.Init(b.ctx, b.getSelectOffset())
joinPlan.SetChildren(leftPlan, rightPlan)
joinPlan.SetSchema(leftPlan.Schema())
Expand All @@ -1760,7 +1747,9 @@ func (b *PlanBuilder) buildSemiJoinForSetOperator(
if err != nil {
return nil, err
}
if leftCol.RetType.GetType() != rightCol.RetType.GetType() || (leftIsColumnList != nil && !leftIsColumnList[j]) {
_, leftArgIsColumn := eqCond.(*expression.ScalarFunction).GetArgs()[0].(*expression.Column)
_, rightArgIsColumn := eqCond.(*expression.ScalarFunction).GetArgs()[1].(*expression.Column)
if leftCol.RetType.GetType() != rightCol.RetType.GetType() || !leftArgIsColumn || !rightArgIsColumn {
joinPlan.OtherConditions = append(joinPlan.OtherConditions, eqCond)
} else {
joinPlan.EqualConditions = append(joinPlan.EqualConditions, eqCond.(*expression.ScalarFunction))
Expand Down

0 comments on commit 45e648f

Please sign in to comment.