Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
winoros committed Dec 12, 2017
1 parent e3be644 commit 4c23535
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
14 changes: 4 additions & 10 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,30 +581,24 @@ func (b *executorBuilder) buildHashJoin(v *plan.PhysicalHashJoin) Executor {
}

defaultValues := v.DefaultValues
if defaultValues == nil {
defaultValues = make([]types.Datum, e.innerExec.Schema().Len())
}
e.resultGenerator = newJoinResultGenerator(b.ctx, v.JoinType, v.SmallChildIdx == 0, defaultValues, v.OtherConditions, nil, nil)
if v.SmallChildIdx == 0 {
e.innerExec = leftExec
e.outerExec = rightExec
e.innerFilter = v.LeftConditions
e.outerFilter = v.RightConditions
e.innerKeys = leftHashKey
e.outerKeys = rightHashKey
if defaultValues == nil {
defaultValues = make([]types.Datum, e.innerExec.Schema().Len())
}
e.resultGenerator = newJoinResultGenerator(b.ctx, v.JoinType, v.SmallChildIdx == 0, defaultValues,
v.OtherConditions, nil, nil)
} else {
e.innerExec = rightExec
e.outerExec = leftExec
e.innerFilter = v.RightConditions
e.outerFilter = v.LeftConditions
e.innerKeys = rightHashKey
e.outerKeys = leftHashKey
if defaultValues == nil {
defaultValues = make([]types.Datum, e.innerExec.Schema().Len())
}
e.resultGenerator = newJoinResultGenerator(b.ctx, v.JoinType, v.SmallChildIdx == 0, defaultValues,
v.OtherConditions, nil, nil)
}

return e
Expand Down
5 changes: 3 additions & 2 deletions plan/logical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ type LogicalJoin struct {
leftProperties [][]*expression.Column
rightProperties [][]*expression.Column

// DefaultValues is only used for outer join, which is values the inner table's should be when the outer table
// doesn't match any inner table'row.
// DefaultValues is only used for left/right outer join, which is values the inner row's should be when the outer table
// doesn't match any inner table's row.
// That it's nil just means the default values is a slice of NULL.
// Currently, only `aggregation push down` phase will set this.
DefaultValues []types.Datum

// redundantSchema contains columns which are eliminated in join.
Expand Down

0 comments on commit 4c23535

Please sign in to comment.