From eaf86f76492d4e0e7b2b7e49aa7311102cfb1e2e Mon Sep 17 00:00:00 2001 From: foxspy Date: Mon, 4 Nov 2024 11:46:28 +0800 Subject: [PATCH] fix: optimize invalid datatype error msg (#37376) issue: #37151 Signed-off-by: xianliang.li --- internal/proxy/task_index.go | 2 +- tests/go_client/testcases/index_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/proxy/task_index.go b/internal/proxy/task_index.go index 3b69f59d4a4bb..914b752807980 100644 --- a/internal/proxy/task_index.go +++ b/internal/proxy/task_index.go @@ -473,7 +473,7 @@ func checkTrain(field *schemapb.FieldSchema, indexParams map[string]string) erro if typeutil.IsVectorType(field.DataType) && indexType != indexparamcheck.AutoIndex { exist := CheckVecIndexWithDataTypeExist(indexType, field.DataType) if !exist { - return fmt.Errorf("data type %d can't build with this index %s", field.DataType, indexType) + return fmt.Errorf("data type %s can't build with this index %s", schemapb.DataType_name[int32(field.GetDataType())], indexType) } } diff --git a/tests/go_client/testcases/index_test.go b/tests/go_client/testcases/index_test.go index 62205321a6d60..e1035055336d9 100644 --- a/tests/go_client/testcases/index_test.go +++ b/tests/go_client/testcases/index_test.go @@ -864,7 +864,7 @@ func TestCreateSparseUnsupportedIndex(t *testing.T) { // create unsupported vector index on sparse field for _, idx := range hp.GenAllFloatIndex(entity.IP) { _, err := mc.CreateIndex(ctx, client.NewCreateIndexOption(schema.CollectionName, common.DefaultSparseVecFieldName, idx)) - common.CheckErr(t, err, false, fmt.Sprintf("data type 104 can't build with this index %v", idx.IndexType())) + common.CheckErr(t, err, false, fmt.Sprintf("data type SparseFloatVector can't build with this index %v", idx.IndexType())) } // create scalar index on sparse vector