test: update cases for binary vectors support HNSW (#44928)

Signed-off-by: nico <cheng.yuan@zilliz.com>
This commit is contained in:
nico 2025-10-18 11:56:01 +08:00 committed by GitHub
parent 27dbb8e75d
commit eae6aff644
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

@ -3,12 +3,14 @@ from common import common_type as ct
success = "success" success = "success"
class HNSW: class HNSW:
supported_vector_types = [ supported_vector_types = [
DataType.FLOAT_VECTOR, DataType.FLOAT_VECTOR,
DataType.FLOAT16_VECTOR, DataType.FLOAT16_VECTOR,
DataType.BFLOAT16_VECTOR, DataType.BFLOAT16_VECTOR,
DataType.INT8_VECTOR DataType.INT8_VECTOR,
DataType.BINARY_VECTOR
] ]
supported_metrics = ['L2', 'IP', 'COSINE'] supported_metrics = ['L2', 'IP', 'COSINE']

View File

@ -1046,12 +1046,13 @@ class TestNewIndexBinary(TestcaseBase):
c_name = cf.gen_unique_str(prefix) c_name = cf.gen_unique_str(prefix)
collection_w = self.init_collection_wrap(name=c_name, schema=default_binary_schema) collection_w = self.init_collection_wrap(name=c_name, schema=default_binary_schema)
binary_index_params = {'index_type': 'HNSW', "M": '18', "efConstruction": '240', 'metric_type': metric_type} binary_index_params = {'index_type': 'HNSW', "M": '18', "efConstruction": '240', 'metric_type': metric_type}
error = {ct.err_code: 999, ct.err_msg: f"binary vector index does not support metric type: {metric_type}"}
if metric_type in ["JACCARD", "HAMMING"]: if metric_type in ["JACCARD", "HAMMING"]:
error = {ct.err_code: 999, ct.err_msg: f"data type BinaryVector can't build with this index HNSW"} collection_w.create_index(default_binary_vec_field_name, binary_index_params)
collection_w.create_index(default_binary_vec_field_name, binary_index_params, else:
check_task=CheckTasks.err_res, error = {ct.err_code: 999, ct.err_msg: f"binary vector index does not support metric type: {metric_type}"}
check_items=error) collection_w.create_index(default_binary_vec_field_name, binary_index_params,
check_task=CheckTasks.err_res,
check_items=error)
@pytest.mark.tags(CaseLabel.L2) @pytest.mark.tags(CaseLabel.L2)
@pytest.mark.parametrize("metric", ct.binary_metrics) @pytest.mark.parametrize("metric", ct.binary_metrics)