@@ -2379,8 +2379,8 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
23792379 UNIT_ASSERT_VALUES_EQUAL (indexDesc.back ().GetDataColumns ().size (), 0 );
23802380
23812381 if (type == EIndexTypeSql::GlobalVectorKMeansTree) {
2382- const TVectorIndexSettings & vectorIndexSettings = * indexDesc.back ().GetVectorIndexSettings ();
2383- UNIT_ASSERT_VALUES_EQUAL (std::get<TVectorIndexSettings::ESimilarity>( vectorIndexSettings.Metric ) , TVectorIndexSettings::ESimilarity ::InnerProduct);
2382+ const auto & vectorIndexSettings = std::get<TKMeansTreeSettings>( indexDesc.back ().GetVectorIndexSettings ()). Settings ;
2383+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.Metric , TVectorIndexSettings::EMetric ::InnerProduct);
23842384 UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorType , TVectorIndexSettings::EVectorType::Float);
23852385 UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorDimension , 1024 );
23862386 }
@@ -2421,8 +2421,8 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
24212421 UNIT_ASSERT_VALUES_EQUAL (indexDesc.back ().GetDataColumns ().size (), 1 );
24222422
24232423 if (type == EIndexTypeSql::GlobalVectorKMeansTree) {
2424- const TVectorIndexSettings & vectorIndexSettings = * indexDesc.back ().GetVectorIndexSettings ();
2425- UNIT_ASSERT_VALUES_EQUAL (std::get<TVectorIndexSettings::ESimilarity>( vectorIndexSettings.Metric ) , TVectorIndexSettings::ESimilarity ::InnerProduct);
2424+ const auto & vectorIndexSettings = std::get<TKMeansTreeSettings>( indexDesc.back ().GetVectorIndexSettings ()). Settings ;
2425+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.Metric , TVectorIndexSettings::EMetric ::InnerProduct);
24262426 UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorType , TVectorIndexSettings::EVectorType::Float);
24272427 UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorDimension , 1024 );
24282428 }
@@ -2775,9 +2775,10 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
27752775 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetIndexColumns ().size (), 1 );
27762776 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetIndexColumns ()[0 ], " Embedding" );
27772777 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetDataColumns ().size (), 0 );
2778- UNIT_ASSERT_VALUES_EQUAL (std::get<NYdb::NTable::TVectorIndexSettings::ESimilarity>(indexDesc.GetVectorIndexSettings ()->Metric ), NYdb::NTable::TVectorIndexSettings::ESimilarity::InnerProduct);
2779- UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetVectorIndexSettings ()->VectorType , NYdb::NTable::TVectorIndexSettings::EVectorType::Float);
2780- UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetVectorIndexSettings ()->VectorDimension , 1024 );
2778+ const auto & vectorIndexSettings = std::get<TKMeansTreeSettings>(indexDesc.GetVectorIndexSettings ()).Settings ;
2779+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.Metric , NYdb::NTable::TVectorIndexSettings::EMetric::InnerProduct);
2780+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorType , NYdb::NTable::TVectorIndexSettings::EVectorType::Float);
2781+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorDimension , 1024 );
27812782 }
27822783 {
27832784 auto describeLevelTable = session.DescribeTable (" /Root/TestTable/vector_idx/indexImplLevelTable" ).GetValueSync ();
@@ -2826,9 +2827,10 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
28262827 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetIndexColumns ()[0 ], " Embedding" );
28272828 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetDataColumns ().size (), 1 );
28282829 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetDataColumns ()[0 ], " Covered" );
2829- UNIT_ASSERT_VALUES_EQUAL (std::get<NYdb::NTable::TVectorIndexSettings::ESimilarity>(indexDesc.GetVectorIndexSettings ()->Metric ), NYdb::NTable::TVectorIndexSettings::ESimilarity::InnerProduct);
2830- UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetVectorIndexSettings ()->VectorType , NYdb::NTable::TVectorIndexSettings::EVectorType::Float);
2831- UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetVectorIndexSettings ()->VectorDimension , 1024 );
2830+ const auto & vectorIndexSettings = std::get<TKMeansTreeSettings>(indexDesc.GetVectorIndexSettings ()).Settings ;
2831+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.Metric , NYdb::NTable::TVectorIndexSettings::EMetric::InnerProduct);
2832+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorType , NYdb::NTable::TVectorIndexSettings::EVectorType::Float);
2833+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorDimension , 1024 );
28322834 }
28332835 }
28342836
@@ -2894,10 +2896,11 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
28942896 .AddNullableColumn (" Key" , EPrimitiveType::Uint64)
28952897 .AddNullableColumn (" Embedding" , EPrimitiveType::String)
28962898 .SetPrimaryKeyColumn (" Key" )
2897- .AddVectorKMeansTreeSecondaryIndex (" vector_idx" , {" Embedding" },
2898- { NYdb::NTable::TVectorIndexSettings::EDistance::Cosine,
2899- NYdb::NTable::TVectorIndexSettings::EVectorType::Float,
2900- 1024 });
2899+ .AddVectorKMeansTreeIndex (" vector_idx" , {" Embedding" }, {TVectorIndexSettings{
2900+ NYdb::NTable::TVectorIndexSettings::EMetric::CosineDistance,
2901+ NYdb::NTable::TVectorIndexSettings::EVectorType::Float,
2902+ 1024 ,
2903+ }});
29012904
29022905 auto result = session.CreateTable (" /Root/TestTable" , builder.Build ()).ExtractValueSync ();
29032906 UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::SUCCESS, result.GetIssues ().ToString ());
@@ -2913,9 +2916,10 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
29132916 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetIndexColumns ().size (), 1 );
29142917 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetIndexColumns ()[0 ], " Embedding" );
29152918 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetDataColumns ().size (), 0 );
2916- UNIT_ASSERT_VALUES_EQUAL (std::get<NYdb::NTable::TVectorIndexSettings::EDistance>(indexDesc.GetVectorIndexSettings ()->Metric ), NYdb::NTable::TVectorIndexSettings::EDistance::Cosine);
2917- UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetVectorIndexSettings ()->VectorType , NYdb::NTable::TVectorIndexSettings::EVectorType::Float);
2918- UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetVectorIndexSettings ()->VectorDimension , 1024 );
2919+ const auto & vectorIndexSettings = std::get<TKMeansTreeSettings>(indexDesc.GetVectorIndexSettings ()).Settings ;
2920+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.Metric , NYdb::NTable::TVectorIndexSettings::EMetric::CosineDistance);
2921+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorType , NYdb::NTable::TVectorIndexSettings::EVectorType::Float);
2922+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorDimension , 1024 );
29192923 }
29202924 }
29212925
@@ -2932,10 +2936,11 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
29322936 .AddNullableColumn (" Embedding" , EPrimitiveType::String)
29332937 .AddNullableColumn (" Covered" , EPrimitiveType::String)
29342938 .SetPrimaryKeyColumn (" Key" )
2935- .AddVectorKMeansTreeSecondaryIndex (" vector_idx" , {" Embedding" }, {" Covered" },
2936- { NYdb::NTable::TVectorIndexSettings::EDistance::Cosine,
2937- NYdb::NTable::TVectorIndexSettings::EVectorType::Float,
2938- 1024 });
2939+ .AddVectorKMeansTreeIndex (" vector_idx" , {" Embedding" }, {" Covered" }, {TVectorIndexSettings{
2940+ NYdb::NTable::TVectorIndexSettings::EMetric::CosineDistance,
2941+ NYdb::NTable::TVectorIndexSettings::EVectorType::Float,
2942+ 1024 ,
2943+ }});
29392944
29402945 auto result = session.CreateTable (" /Root/TestTable" , builder.Build ()).ExtractValueSync ();
29412946 UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::SUCCESS, result.GetIssues ().ToString ());
@@ -2952,9 +2957,10 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
29522957 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetIndexColumns ()[0 ], " Embedding" );
29532958 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetDataColumns ().size (), 1 );
29542959 UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetDataColumns ()[0 ], " Covered" );
2955- UNIT_ASSERT_VALUES_EQUAL (std::get<NYdb::NTable::TVectorIndexSettings::EDistance>(indexDesc.GetVectorIndexSettings ()->Metric ), NYdb::NTable::TVectorIndexSettings::EDistance::Cosine);
2956- UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetVectorIndexSettings ()->VectorType , NYdb::NTable::TVectorIndexSettings::EVectorType::Float);
2957- UNIT_ASSERT_VALUES_EQUAL (indexDesc.GetVectorIndexSettings ()->VectorDimension , 1024 );
2960+ const auto & vectorIndexSettings = std::get<TKMeansTreeSettings>(indexDesc.GetVectorIndexSettings ()).Settings ;
2961+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.Metric , NYdb::NTable::TVectorIndexSettings::EMetric::CosineDistance);
2962+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorType , NYdb::NTable::TVectorIndexSettings::EVectorType::Float);
2963+ UNIT_ASSERT_VALUES_EQUAL (vectorIndexSettings.VectorDimension , 1024 );
29582964 }
29592965 }
29602966
0 commit comments