From 887eaa9596780494bf7eece37cfb9c62a1ea0693 Mon Sep 17 00:00:00 2001 From: cqy123456 Date: Thu, 6 Jun 2024 09:46:42 -0500 Subject: [PATCH] enhance: proxy check hnsw with sparse is legal Signed-off-by: cqy123456 --- pkg/util/indexparamcheck/hnsw_checker.go | 5 ++--- pkg/util/indexparamcheck/hnsw_checker_test.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/util/indexparamcheck/hnsw_checker.go b/pkg/util/indexparamcheck/hnsw_checker.go index 56146e246813d..6ff556f22b1a5 100644 --- a/pkg/util/indexparamcheck/hnsw_checker.go +++ b/pkg/util/indexparamcheck/hnsw_checker.go @@ -32,9 +32,8 @@ func (c hnswChecker) CheckTrain(params map[string]string) error { } func (c hnswChecker) CheckValidDataType(dType schemapb.DataType) error { - // TODO(SPARSE) we'll add sparse vector support in HNSW later in cardinal - if !typeutil.IsDenseFloatVectorType(dType) { - return fmt.Errorf("HNSW only support float vector data type") + if !typeutil.IsVectorType(dType) { + return fmt.Errorf("can't build hnsw in not vector type.") } return nil } diff --git a/pkg/util/indexparamcheck/hnsw_checker_test.go b/pkg/util/indexparamcheck/hnsw_checker_test.go index e2e374e0c9a38..bcb7c482a1781 100644 --- a/pkg/util/indexparamcheck/hnsw_checker_test.go +++ b/pkg/util/indexparamcheck/hnsw_checker_test.go @@ -158,7 +158,7 @@ func Test_hnswChecker_CheckValidDataType(t *testing.T) { }, { dType: schemapb.DataType_BinaryVector, - errIsNil: false, + errIsNil: true, }, }