@@ -3238,6 +3238,77 @@ Y_UNIT_TEST_SUITE(KqpIndexes) {
3238
3238
DoPositiveQueriesPrefixedVectorIndexOrderByCosine (session);
3239
3239
}
3240
3240
3241
+ Y_UNIT_TEST (VectorIndexIsNotUpdatable) {
3242
+ NKikimrConfig::TFeatureFlags featureFlags;
3243
+ featureFlags.SetEnableVectorIndex (true );
3244
+ auto setting = NKikimrKqp::TKqpSetting ();
3245
+ auto serverSettings = TKikimrSettings ()
3246
+ .SetFeatureFlags (featureFlags)
3247
+ .SetKqpSettings ({setting});
3248
+
3249
+ TKikimrRunner kikimr (serverSettings);
3250
+ kikimr.GetTestServer ().GetRuntime ()->SetLogPriority (NKikimrServices::BUILD_INDEX, NActors::NLog::PRI_TRACE);
3251
+
3252
+ auto db = kikimr.GetTableClient ();
3253
+ auto session = DoCreateTableForVectorIndex (db, true );
3254
+
3255
+ // Add first index
3256
+ {
3257
+ const TString createIndex (Q_ (R"(
3258
+ ALTER TABLE `/Root/TestTable`
3259
+ ADD INDEX index1
3260
+ GLOBAL USING vector_kmeans_tree
3261
+ ON (emb)
3262
+ WITH (similarity=cosine, vector_type="uint8", vector_dimension=2, levels=2, clusters=2);
3263
+ )" ));
3264
+
3265
+ auto result = session.ExecuteSchemeQuery (createIndex).ExtractValueSync ();
3266
+
3267
+ UNIT_ASSERT_C (result.IsSuccess (), result.GetIssues ().ToString ());
3268
+ }
3269
+
3270
+ const TString originalPostingTable = ReadTablePartToYson (session, " /Root/TestTable/index1/indexImplPostingTable" );
3271
+
3272
+ // Upsert to the table with index should succeed
3273
+ {
3274
+ const TString query1 (Q_ (R"(
3275
+ UPSERT INTO `/Root/TestTable` (pk, emb, data) VALUES)"
3276
+ " (10, \"\x76\x76\x03\" , \" 10\" );"
3277
+ ));
3278
+
3279
+ auto result = session.ExecuteDataQuery (
3280
+ query1,
3281
+ TTxControl::BeginTx (TTxSettings::SerializableRW ()).CommitTx ())
3282
+ .ExtractValueSync ();
3283
+ UNIT_ASSERT (result.IsSuccess ());
3284
+ }
3285
+
3286
+ const TString postingTable1 = ReadTablePartToYson (session, " /Root/TestTable/index1/indexImplPostingTable" );
3287
+
3288
+ // First index is not updated
3289
+ UNIT_ASSERT_STRINGS_EQUAL (originalPostingTable, postingTable1);
3290
+
3291
+ // Add second index
3292
+ {
3293
+ const TString createIndex (Q_ (R"(
3294
+ ALTER TABLE `/Root/TestTable`
3295
+ ADD INDEX index2
3296
+ GLOBAL USING vector_kmeans_tree
3297
+ ON (emb)
3298
+ WITH (similarity=cosine, vector_type="uint8", vector_dimension=2, levels=2, clusters=2);
3299
+ )" ));
3300
+
3301
+ auto result = session.ExecuteSchemeQuery (createIndex).ExtractValueSync ();
3302
+
3303
+ UNIT_ASSERT_C (result.IsSuccess (), result.GetIssues ().ToString ());
3304
+ }
3305
+
3306
+ const TString postingTable2 = ReadTablePartToYson (session, " /Root/TestTable/index2/indexImplPostingTable" );
3307
+
3308
+ // Second index is different
3309
+ UNIT_ASSERT_STRINGS_UNEQUAL (originalPostingTable, postingTable2);
3310
+ }
3311
+
3241
3312
Y_UNIT_TEST (ExplainCollectFullDiagnostics) {
3242
3313
auto setting = NKikimrKqp::TKqpSetting ();
3243
3314
auto serverSettings = TKikimrSettings ()
0 commit comments