From 0d1abb081bb0b4ee6970f3f0c190a7ef2637fb97 Mon Sep 17 00:00:00 2001 From: Cai Yudong Date: Wed, 3 Apr 2024 14:53:14 +0800 Subject: [PATCH] enhance: Disable HNSW Binary (#31825) Issue: #31494 Signed-off-by: Cai Yudong --- pkg/util/indexparamcheck/hnsw_checker.go | 4 ++-- pkg/util/indexparamcheck/hnsw_checker_test.go | 2 +- tests/python_client/testcases/test_search.py | 2 +- .../restful_client_v2/testcases/test_collection_operations.py | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/util/indexparamcheck/hnsw_checker.go b/pkg/util/indexparamcheck/hnsw_checker.go index 522b31fe16..61a4f97d06 100644 --- a/pkg/util/indexparamcheck/hnsw_checker.go +++ b/pkg/util/indexparamcheck/hnsw_checker.go @@ -32,8 +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 dType != schemapb.DataType_FloatVector && dType != schemapb.DataType_BinaryVector && dType != schemapb.DataType_Float16Vector && dType != schemapb.DataType_BFloat16Vector { - return fmt.Errorf("only support float vector or binary vector") + if dType != schemapb.DataType_FloatVector && dType != schemapb.DataType_Float16Vector && dType != schemapb.DataType_BFloat16Vector { + return fmt.Errorf("HNSW only support float vector data type") } return nil } diff --git a/pkg/util/indexparamcheck/hnsw_checker_test.go b/pkg/util/indexparamcheck/hnsw_checker_test.go index bcb7c482a1..e2e374e0c9 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: true, + errIsNil: false, }, } diff --git a/tests/python_client/testcases/test_search.py b/tests/python_client/testcases/test_search.py index 2fc4ce6897..52ef7cb844 100644 --- a/tests/python_client/testcases/test_search.py +++ b/tests/python_client/testcases/test_search.py @@ -3722,7 +3722,7 @@ class TestCollectionSearch(TestcaseBase): @pytest.mark.tags(CaseLabel.L1) @pytest.mark.parametrize("metrics", ct.binary_metrics[:2]) - @pytest.mark.parametrize("index", ["BIN_FLAT", "BIN_IVF_FLAT", "HNSW"]) + @pytest.mark.parametrize("index", ["BIN_FLAT", "BIN_IVF_FLAT"]) def test_search_output_field_vector_after_binary_index(self, metrics, index): """ target: test search with output vector field after binary index diff --git a/tests/restful_client_v2/testcases/test_collection_operations.py b/tests/restful_client_v2/testcases/test_collection_operations.py index 8e60881832..859cb84fa9 100644 --- a/tests/restful_client_v2/testcases/test_collection_operations.py +++ b/tests/restful_client_v2/testcases/test_collection_operations.py @@ -389,6 +389,7 @@ class TestCreateCollection(TestBase): @pytest.mark.parametrize("enable_partition_key", [True]) @pytest.mark.parametrize("dim", [128]) @pytest.mark.parametrize("metric_type", ["JACCARD", "HAMMING"]) + @pytest.mark.skip(reason="https://github.com/milvus-io/milvus/issues/31494") def test_create_collections_binary_vector_datatype(self, dim, auto_id, enable_dynamic_field, enable_partition_key, metric_type): """