Skip to content

Commit

Permalink
refactor: move collation check inside canHashJoin function
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <[email protected]>
  • Loading branch information
systay committed Nov 22, 2021
1 parent 51b97da commit ccee93d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions go/vt/vtgate/planbuilder/querytree_transformers.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,6 @@ func transformJoinPlan(ctx *planningContext, n *joinTree) (logicalPlan, error) {
opCode = engine.LeftJoin
}

if lhsInfo.typ.Collation != rhsInfo.typ.Collation {
// joins with different collations are not yet supported
canHashJoin = false
}

if canHashJoin {
coercedType, err := evalengine.CoerceTo(lhsInfo.typ.Type, rhsInfo.typ.Type)
if err != nil {
Expand Down Expand Up @@ -580,6 +575,13 @@ func canHashJoin(ctx *planningContext, n *joinTree) (canHash bool, lhs, rhs join
if !found {
return
}

if colType.Collation != argType.Collation {
// joins with different collations are not yet supported
canHash = false
return
}

if colOnLeft {
lhs.typ = colType
rhs.typ = argType
Expand Down

0 comments on commit ccee93d

Please sign in to comment.