test: Fix index creation mismatch for sparse vector columns in multivector case (#34618)

If `is_all_data_type` is true, the case will add float32, f16, bf16, and
sparse vectors, but the created indexes are all `flat` indexes by
default. The sparse type cannot create a flat index. Fix the test code
to create a `SPARSE_INVERTED_INDEX` index for the sparse vector when
is_all_data_type is true

Signed-off-by: elstic <hao.wang@zilliz.com>
pull/33770/head^2
elstic 2024-07-13 10:45:37 +08:00 committed by GitHub
parent 93a500676b
commit 2c462d387b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -301,7 +301,11 @@ class TestcaseBase(Base):
if len(multiple_dim_array) == 0 or is_all_data_type == False:
vector_name_list.append(ct.default_float_vec_field_name)
for vector_name in vector_name_list:
collection_w.create_index(vector_name, ct.default_flat_index)
# Unlike dense vectors, sparse vectors cannot create flat index.
if ct.sparse_vector in vector_name:
collection_w.create_index(vector_name, ct.default_sparse_inverted_index)
else:
collection_w.create_index(vector_name, ct.default_flat_index)
collection_w.load()