Skip to content

Commit

Permalink
Added IN to indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hydrocharged committed Jul 8, 2024
1 parent 4a4887b commit a891d3f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/analyzer/indexes.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func IndexLeafChildren(e sql.Expression) (analyzer.IndexScanOp, sql.Expression,
default:
return 0, nil, nil, false
}
case *pgexprs.InTuple:
op = analyzer.IndexScanOpInSet
left = expr.Left()
right = expr.Right()
default:
return 0, nil, nil, false
}
Expand All @@ -76,6 +80,13 @@ func IndexLeafChildren(e sql.Expression) (analyzer.IndexScanOp, sql.Expression,
}
rightType, ok := right.Type().(pgtypes.DoltgresType)
if !ok {
if tuple, ok := right.(expression.Tuple); ok {
newTuple := make(expression.Tuple, len(tuple))
for i := range tuple {
newTuple[i] = pgexprs.NewExplicitCast(tuple[i], leftType)
}
return op, left, newTuple, true
}
return 0, nil, nil, false
}
if !leftType.Equals(rightType) {
Expand Down

0 comments on commit a891d3f

Please sign in to comment.