diff --git a/tests/db/index/CMakeLists.txt b/tests/db/index/CMakeLists.txt index 441f49009..631b723ca 100644 --- a/tests/db/index/CMakeLists.txt +++ b/tests/db/index/CMakeLists.txt @@ -44,7 +44,7 @@ foreach(CC_SRCS ${ALL_TEST_SRCS}) core_quantizer_static core_knn_hnsw core_knn_hnsw_sparse sparsehash core_knn_flat core_knn_flat_sparse core_knn_ivf - core_knn_hnsw_rabitq core_mix_reducer + core_knn_hnsw_rabitq core_knn_vamana core_mix_reducer Arrow::arrow_dataset ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} diff --git a/tests/db/index/segment/segment_helper_test.cc b/tests/db/index/segment/segment_helper_test.cc index 123ee28ad..a93dbeef2 100644 --- a/tests/db/index/segment/segment_helper_test.cc +++ b/tests/db/index/segment/segment_helper_test.cc @@ -638,6 +638,11 @@ class SegmentCompactReuseTest p->set_is_linear(true); return p; } + case IndexType::VAMANA: { + auto p = std::make_shared(); + p->set_is_linear(true); + return p; + } case IndexType::FLAT: default: return std::make_shared(); @@ -759,9 +764,9 @@ INSTANTIATE_TEST_SUITE_P(Hnsw, SegmentCompactReuseTest, // CreateNormalSchema() only puts the test's vector_index_params on dense_fp32. // The other 4 vector fields are hardcoded — dense_fp16/dense_int8/sparse_fp16 -// are always FlatIndexParams, and sparse_fp32 gets the -// cloned params only if supports_sparse is true (utils.cc:117-124), which -// excludes IVF and HNSW_RABITQ — so for IVF it also falls back to FLAT. +// are always FlatIndexParams, and sparse_fp32 gets the cloned params only if +// supports_sparse is true (utils.cc:117-124), which excludes IVF / HNSW_RABITQ +// Vamana. For these cases the merged indexer should be FLAT. INSTANTIATE_TEST_SUITE_P( Ivf, SegmentCompactReuseTest, @@ -778,6 +783,13 @@ INSTANTIATE_TEST_SUITE_P(HnswRabitq, SegmentCompactReuseTest, IndexType::HNSW_RABITQ})); #endif +INSTANTIATE_TEST_SUITE_P(Vamana, SegmentCompactReuseTest, + testing::Values(SegmentCompactReuseParam{ + std::make_shared( + MetricType::IP, 16, 100, 1.2f, false, false, + false, QuantizeType::UNDEFINED), + IndexType::VAMANA})); + TEST_F(SegmentHelperTest, CompactTask_FilterMultiSegmentsRegression) { auto schema = test::TestHelper::CreateSchemaWithVectorIndex(); auto version_manager = CreateVersionManager(*schema); diff --git a/tests/db/index/utils/utils.cc b/tests/db/index/utils/utils.cc index 95a72a94a..d60d7b64a 100644 --- a/tests/db/index/utils/utils.cc +++ b/tests/db/index/utils/utils.cc @@ -112,11 +112,11 @@ CollectionSchema::Ptr TestHelper::CreateNormalSchema( "dense_int8", DataType::VECTOR_INT8, 128, false, std::make_shared(MetricType::IP))); - // IVF and HNSW_RABITQ do not support sparse vectors, always use Flat for - // sparse fields in those cases. + // Only FLAT and HNSW support sparse vectors (see schema.cc:60-61); + // everything else uses Flat for sparse fields. auto supports_sparse = [](const IndexParams::Ptr ¶ms) { auto type = params->type(); - return type != IndexType::IVF && type != IndexType::HNSW_RABITQ; + return type == IndexType::FLAT || type == IndexType::HNSW; }; IndexParams::Ptr sparse_index_params;