Skip to content

Commit 0883bbc

Browse files
committed
type conversion for in set
1 parent 7f6dddf commit 0883bbc

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

sql/analyzer/costed_index_scan.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,14 +1425,25 @@ func newLeaf(ctx *sql.Context, id indexScanId, e sql.Expression, underlying stri
14251425
if op == sql.IndexScanOpInSet || op == sql.IndexScanOpNotInSet {
14261426
tup := right.(expression.Tuple)
14271427
var litSet []interface{}
1428+
var litType sql.Type
14281429
for _, lit := range tup {
14291430
value, err := lit.Eval(ctx, nil)
14301431
if err != nil {
14311432
return nil, false
14321433
}
14331434
litSet = append(litSet, value)
1435+
if litType == nil {
1436+
litType = lit.Type()
1437+
}
14341438
}
1435-
return &iScanLeaf{id: id, gf: gf, op: op, setValues: litSet, underlying: underlying}, true
1439+
return &iScanLeaf{
1440+
id: id,
1441+
gf: gf,
1442+
op: op,
1443+
setValues: litSet,
1444+
litType: litType,
1445+
underlying: underlying,
1446+
}, true
14361447
}
14371448

14381449
value, err := right.Eval(ctx, nil)

0 commit comments

Comments
 (0)