From 6f6fdf55ac8cbb8ad26ef45700bdc3ac05f1fdcd Mon Sep 17 00:00:00 2001 From: ou yuanning <45346669+ouyuanning@users.noreply.github.com> Date: Fri, 11 Oct 2024 18:02:01 +0800 Subject: [PATCH] fix bug: SortAndCompact get incorrect value (#19056) (#19240) fix bug: SortAndCompact get incorrect value Approved by: @m-schen, @heni02, @XuPeng-SH, @aunjgr, @sukki37 --- pkg/container/vector/vector.go | 26 +- pkg/container/vector/vector_test.go | 15 + pkg/sql/plan/function/list_operator.go | 561 ++++++++++++++++++ .../cases/dml/select/select.result | 18 +- test/distributed/cases/dml/select/select.test | 17 +- 5 files changed, 625 insertions(+), 12 deletions(-) diff --git a/pkg/container/vector/vector.go b/pkg/container/vector/vector.go index ae630bca83fd0..5efb6d84595c4 100644 --- a/pkg/container/vector/vector.go +++ b/pkg/container/vector/vector.go @@ -3691,6 +3691,14 @@ func (v *Vector) GetMinMaxValue() (ok bool, minv, maxv []byte) { // InplaceSortAndCompact @todo optimization in the future func (v *Vector) InplaceSortAndCompact() { + cleanDataNotResetArea := func() { + if v.data != nil { + v.length = 0 + } + v.nsp.Reset() + v.sorted = true + } + switch v.GetType().Oid { case types.T_bool: col := MustFixedCol[bool](v) @@ -3973,49 +3981,47 @@ func (v *Vector) InplaceSortAndCompact() { newCol := slices.CompactFunc(col, func(a, b types.Varlena) bool { return bytes.Equal(a.GetByteSlice(area), b.GetByteSlice(area)) }) + if len(newCol) != len(col) { - v.CleanOnlyData() - v.SetSorted(true) + cleanDataNotResetArea() appendList(v, newCol, nil, nil) } case types.T_array_float32: col, area := MustVarlenaRawData(v) sort.Slice(col, func(i, j int) bool { - return moarray.Compare[float32]( + return moarray.Compare( types.GetArray[float32](&col[i], area), types.GetArray[float32](&col[j], area), ) < 0 }) newCol := slices.CompactFunc(col, func(a, b types.Varlena) bool { - return moarray.Compare[float32]( + return moarray.Compare( types.GetArray[float32](&a, area), types.GetArray[float32](&b, area), ) == 0 }) if len(newCol) != len(col) { - v.CleanOnlyData() - v.SetSorted(true) + cleanDataNotResetArea() appendList(v, newCol, nil, nil) } case types.T_array_float64: col, area := MustVarlenaRawData(v) sort.Slice(col, func(i, j int) bool { - return moarray.Compare[float64]( + return moarray.Compare( types.GetArray[float64](&col[i], area), types.GetArray[float64](&col[j], area), ) < 0 }) newCol := slices.CompactFunc(col, func(a, b types.Varlena) bool { - return moarray.Compare[float64]( + return moarray.Compare( types.GetArray[float64](&a, area), types.GetArray[float64](&b, area), ) == 0 }) if len(newCol) != len(col) { - v.CleanOnlyData() - v.SetSorted(true) + cleanDataNotResetArea() appendList(v, newCol, nil, nil) } } diff --git a/pkg/container/vector/vector_test.go b/pkg/container/vector/vector_test.go index a97c01be13bf6..71c57791d11a8 100644 --- a/pkg/container/vector/vector_test.go +++ b/pkg/container/vector/vector_test.go @@ -1741,6 +1741,21 @@ func TestSetFunction(t *testing.T) { } } +func TestSortAndCompact(t *testing.T) { + mp := mpool.MustNewZero() + v := NewVec(types.New(types.T_array_float32, 4, 0)) + err := AppendArrayList(v, [][]float32{{1, 2, 3, 0}, {1, 2, 3, 0}}, nil, mp) + require.NoError(t, err) + v.InplaceSortAndCompact() + require.Equal(t, v.length, 1) + + v = NewVec(types.New(types.T_array_float64, 4, 0)) + err = AppendArrayList(v, [][]float64{{1.1, 2, 3, 0}, {1.1, 2, 3, 0}}, nil, mp) + require.NoError(t, err) + v.InplaceSortAndCompact() + require.Equal(t, v.length, 1) +} + func TestSetFunction2(t *testing.T) { // set vec to const value -> const null -> const value -> const null. // bool type diff --git a/pkg/sql/plan/function/list_operator.go b/pkg/sql/plan/function/list_operator.go index bcb5dd48091a1..fb0fc9b9fda31 100644 --- a/pkg/sql/plan/function/list_operator.go +++ b/pkg/sql/plan/function/list_operator.go @@ -718,6 +718,286 @@ var supportedOperators = []FuncNew{ return newOpOperatorStrIn().operatorIn }, }, + // { + // overloadId: 24, + // args: []types.T{types.T_uint8, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[uint8]().operatorIn + // }, + // }, + // { + // overloadId: 25, + // args: []types.T{types.T_uint16, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[uint16]().operatorIn + // }, + // }, + // { + // overloadId: 26, + // args: []types.T{types.T_uint32, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[uint32]().operatorIn + // }, + // }, + // { + // overloadId: 27, + // args: []types.T{types.T_uint64, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[uint64]().operatorIn + // }, + // }, + // { + // overloadId: 28, + // args: []types.T{types.T_int8, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[int8]().operatorIn + // }, + // }, + // { + // overloadId: 29, + // args: []types.T{types.T_int16, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[int16]().operatorIn + // }, + // }, + // { + // overloadId: 30, + // args: []types.T{types.T_int32, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[int32]().operatorIn + // }, + // }, + // { + // overloadId: 31, + // args: []types.T{types.T_int64, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[int64]().operatorIn + // }, + // }, + // { + // overloadId: 32, + // args: []types.T{types.T_float32, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[float32]().operatorIn + // }, + // }, + // { + // overloadId: 33, + // args: []types.T{types.T_float64, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[float64]().operatorIn + // }, + // }, + // { + // overloadId: 34, + // args: []types.T{types.T_decimal64, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Decimal64]().operatorIn + // }, + // }, + // { + // overloadId: 35, + // args: []types.T{types.T_decimal128, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Decimal128]().operatorIn + // }, + // }, + // { + // overloadId: 36, + // args: []types.T{types.T_varchar, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorIn + // }, + // }, + // { + // overloadId: 37, + // args: []types.T{types.T_char, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorIn + // }, + // }, + // { + // overloadId: 38, + // args: []types.T{types.T_date, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Date]().operatorIn + // }, + // }, + // { + // overloadId: 39, + // args: []types.T{types.T_datetime, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Datetime]().operatorIn + // }, + // }, + // { + // overloadId: 40, + // args: []types.T{types.T_bool, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[bool]().operatorIn + // }, + // }, + // { + // overloadId: 41, + // args: []types.T{types.T_timestamp, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Timestamp]().operatorIn + // }, + // }, + // { + // overloadId: 42, + // args: []types.T{types.T_blob, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorIn + // }, + // }, + // { + // overloadId: 43, + // args: []types.T{types.T_uuid, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Uuid]().operatorIn + // }, + // }, + // { + // overloadId: 44, + // args: []types.T{types.T_text, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorIn + // }, + // }, + // { + // overloadId: 45, + // args: []types.T{types.T_time, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Time]().operatorIn + // }, + // }, + // { + // overloadId: 46, + // args: []types.T{types.T_binary, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorIn + // }, + // }, + // { + // overloadId: 47, + // args: []types.T{types.T_varbinary, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorIn + // }, + // }, + { + overloadId: 24, + args: []types.T{types.T_array_float32, types.T_array_float32}, + retType: func(parameters []types.Type) types.Type { + return types.T_bool.ToType() + }, + newOp: func() executeLogicOfOverload { + return newOpOperatorStrIn().operatorIn + }, + }, + // { + // overloadId: 49, + // args: []types.T{types.T_array_float32, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorIn + // }, + // }, + { + overloadId: 25, + args: []types.T{types.T_array_float64, types.T_array_float64}, + retType: func(parameters []types.Type) types.Type { + return types.T_bool.ToType() + }, + newOp: func() executeLogicOfOverload { + return newOpOperatorStrIn().operatorIn + }, + }, + // { + // overloadId: 51, + // args: []types.T{types.T_array_float64, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorIn + // }, + // }, }, }, @@ -969,6 +1249,287 @@ var supportedOperators = []FuncNew{ return newOpOperatorStrIn().operatorNotIn }, }, + + // { + // overloadId: 24, + // args: []types.T{types.T_uint8, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[uint8]().operatorNotIn + // }, + // }, + // { + // overloadId: 25, + // args: []types.T{types.T_uint16, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[uint16]().operatorNotIn + // }, + // }, + // { + // overloadId: 26, + // args: []types.T{types.T_uint32, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[uint32]().operatorNotIn + // }, + // }, + // { + // overloadId: 27, + // args: []types.T{types.T_uint64, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[uint64]().operatorNotIn + // }, + // }, + // { + // overloadId: 28, + // args: []types.T{types.T_int8, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[int8]().operatorNotIn + // }, + // }, + // { + // overloadId: 29, + // args: []types.T{types.T_int16, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[int16]().operatorNotIn + // }, + // }, + // { + // overloadId: 30, + // args: []types.T{types.T_int32, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[int32]().operatorNotIn + // }, + // }, + // { + // overloadId: 31, + // args: []types.T{types.T_int64, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[int64]().operatorNotIn + // }, + // }, + // { + // overloadId: 32, + // args: []types.T{types.T_float32, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[float32]().operatorNotIn + // }, + // }, + // { + // overloadId: 33, + // args: []types.T{types.T_float64, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[float64]().operatorNotIn + // }, + // }, + // { + // overloadId: 34, + // args: []types.T{types.T_decimal64, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Decimal64]().operatorNotIn + // }, + // }, + // { + // overloadId: 35, + // args: []types.T{types.T_decimal128, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Decimal128]().operatorNotIn + // }, + // }, + // { + // overloadId: 36, + // args: []types.T{types.T_varchar, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorNotIn + // }, + // }, + // { + // overloadId: 37, + // args: []types.T{types.T_char, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorNotIn + // }, + // }, + // { + // overloadId: 38, + // args: []types.T{types.T_date, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Date]().operatorNotIn + // }, + // }, + // { + // overloadId: 39, + // args: []types.T{types.T_datetime, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Datetime]().operatorNotIn + // }, + // }, + // { + // overloadId: 40, + // args: []types.T{types.T_bool, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[bool]().operatorNotIn + // }, + // }, + // { + // overloadId: 41, + // args: []types.T{types.T_timestamp, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Timestamp]().operatorNotIn + // }, + // }, + // { + // overloadId: 42, + // args: []types.T{types.T_blob, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorNotIn + // }, + // }, + // { + // overloadId: 43, + // args: []types.T{types.T_uuid, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Uuid]().operatorNotIn + // }, + // }, + // { + // overloadId: 44, + // args: []types.T{types.T_text, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorNotIn + // }, + // }, + // { + // overloadId: 45, + // args: []types.T{types.T_time, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorFixedIn[types.Time]().operatorNotIn + // }, + // }, + // { + // overloadId: 46, + // args: []types.T{types.T_binary, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorNotIn + // }, + // }, + // { + // overloadId: 47, + // args: []types.T{types.T_varbinary, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorNotIn + // }, + // }, + // { + // overloadId: 48, + // args: []types.T{types.T_array_float32, types.T_array_float32}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorNotIn + // }, + // }, + // { + // overloadId: 49, + // args: []types.T{types.T_array_float32, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorNotIn + // }, + // }, + // { + // overloadId: 50, + // args: []types.T{types.T_array_float64, types.T_array_float64}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorNotIn + // }, + // }, + // { + // overloadId: 51, + // args: []types.T{types.T_array_float64, types.T_tuple}, + // retType: func(parameters []types.Type) types.Type { + // return types.T_bool.ToType() + // }, + // newOp: func() executeLogicOfOverload { + // return newOpOperatorStrIn().operatorNotIn + // }, + // }, }, }, diff --git a/test/distributed/cases/dml/select/select.result b/test/distributed/cases/dml/select/select.result index d37542c0aa626..416ebb6629d9c 100755 --- a/test/distributed/cases/dml/select/select.result +++ b/test/distributed/cases/dml/select/select.result @@ -494,4 +494,20 @@ insert into t1 select result, result || "_a",result+100000000 from generate_seri select * from t1 where b in ("11_a","21_a"); a b c 11 11_a 100000011 -21 21_a 100000021 \ No newline at end of file +21 21_a 100000021 +drop table if exists t1; +create table t1(a int primary key, b int, c varchar(200)); +insert into t1 select result, result, "aabbccddeeffgghhii_"||result from generate_series (1, 100000)g; +select a from t1 where c in ("123456789012345678901234567890","123456789012345678901234567890","aabbccddeeffgghhii_100000"); +a +100000 +drop table if exists t1; +create table t1(a int primary key, b vecf32(10)); +insert into t1 select result, "[0.11,0.22,0.33,0.44,0.55,0.66,0.77,0.88,0.99,0.101]" from generate_series (1, 100000)g; +select a from t1 where b in ("[1.11,1.22,1.33,1.44,1.55,1.66,1.77,1.88,1.99,1.101]","[1.11,1.22,1.33,1.44,1.55,1.66,1.77,1.88,1.99,1.102]"); +a +drop table if exists t1; +create table t1(a int primary key, b vecf64(10)); +insert into t1 select result, "[0.11,0.22,0.33,0.44,0.55,0.66,0.77,0.88,0.99,0.101]" from generate_series (1, 100000)g; +select a from t1 where b in ("[1.11,1.22,1.33,1.44,1.55,1.66,1.77,1.88,1.99,1.101]","[1.11,1.22,1.33,1.44,1.55,1.66,1.77,1.88,1.99,1.102]"); +a \ No newline at end of file diff --git a/test/distributed/cases/dml/select/select.test b/test/distributed/cases/dml/select/select.test index e6a2475e88ad4..31697e53b0a56 100755 --- a/test/distributed/cases/dml/select/select.test +++ b/test/distributed/cases/dml/select/select.test @@ -267,4 +267,19 @@ select * from t1 where a in (3,3,3,2,1); drop table if exists t1; create table t1 (a int, b varchar, c int, primary key (c,a), key idx_b(b)); insert into t1 select result, result || "_a",result+100000000 from generate_series(1,10000) g; -select * from t1 where b in ("11_a","21_a"); \ No newline at end of file +select * from t1 where b in ("11_a","21_a"); + +drop table if exists t1; +create table t1(a int primary key, b int, c varchar(200)); +insert into t1 select result, result, "aabbccddeeffgghhii_"||result from generate_series (1, 100000)g; +select a from t1 where c in ("123456789012345678901234567890","123456789012345678901234567890","aabbccddeeffgghhii_100000"); + +drop table if exists t1; +create table t1(a int primary key, b vecf32(10)); +insert into t1 select result, "[0.11,0.22,0.33,0.44,0.55,0.66,0.77,0.88,0.99,0.101]" from generate_series (1, 100000)g; +select a from t1 where b in ("[1.11,1.22,1.33,1.44,1.55,1.66,1.77,1.88,1.99,1.101]","[1.11,1.22,1.33,1.44,1.55,1.66,1.77,1.88,1.99,1.102]"); + +drop table if exists t1; +create table t1(a int primary key, b vecf64(10)); +insert into t1 select result, "[0.11,0.22,0.33,0.44,0.55,0.66,0.77,0.88,0.99,0.101]" from generate_series (1, 100000)g; +select a from t1 where b in ("[1.11,1.22,1.33,1.44,1.55,1.66,1.77,1.88,1.99,1.101]","[1.11,1.22,1.33,1.44,1.55,1.66,1.77,1.88,1.99,1.102]"); \ No newline at end of file