mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 21:09:06 +08:00
de9ed42623
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
40 lines
871 B
Go
40 lines
871 B
Go
package proxy
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
|
"github.com/milvus-io/milvus/internal/common"
|
|
)
|
|
|
|
func Test_getPrimaryKeysFromExpr(t *testing.T) {
|
|
t.Run("delete on non-pk field", func(t *testing.T) {
|
|
schema := &schemapb.CollectionSchema{
|
|
Name: "test_delete",
|
|
Description: "",
|
|
AutoID: false,
|
|
Fields: []*schemapb.FieldSchema{
|
|
{
|
|
FieldID: common.StartOfUserFieldID,
|
|
Name: "pk",
|
|
IsPrimaryKey: true,
|
|
DataType: schemapb.DataType_Int64,
|
|
},
|
|
{
|
|
FieldID: common.StartOfUserFieldID + 1,
|
|
Name: "non_pk",
|
|
IsPrimaryKey: false,
|
|
DataType: schemapb.DataType_Int64,
|
|
},
|
|
},
|
|
}
|
|
|
|
expr := "non_pk in [1, 2, 3]"
|
|
|
|
_, _, err := getPrimaryKeysFromExpr(schema, expr)
|
|
assert.Error(t, err)
|
|
})
|
|
}
|