@@ -4125,7 +4125,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
4125
4125
} else {
4126
4126
query = Sprintf(R"(
4127
4127
--!syntax_v1
4128
- ALTER TABLE `/Root/TestTable` ADD INDEX vector_idx%d
4128
+ ALTER TABLE `/Root/TestTable` ADD INDEX vector_idx%d
4129
4129
GLOBAL USING vector_kmeans_tree
4130
4130
ON (Embedding)
4131
4131
WITH (%s);
@@ -4149,18 +4149,18 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
4149
4149
// valid settings:
4150
4150
check("similarity=inner_product, vector_type=float, vector_dimension=1024, levels=3, clusters=10", "");
4151
4151
4152
- // unknown index setting:
4152
+ // unknown index setting:
4153
4153
check("XxX=YyY, similarity=inner_product, vector_type=float, vector_dimension=1024, levels=3, clusters=10",
4154
4154
"Unknown index setting: xxx");
4155
4155
check("XxX=42, similarity=inner_product, vector_type=float, vector_dimension=1024, levels=3, clusters=10",
4156
4156
"Unknown index setting: xxx");
4157
-
4157
+
4158
4158
// distance:
4159
4159
check("distance=XxX, vector_type=float, vector_dimension=1024, levels=3, clusters=10",
4160
4160
"Invalid distance: xxx");
4161
4161
check("distance=42, vector_type=float, vector_dimension=1024, levels=3, clusters=10",
4162
4162
"Invalid distance: 42");
4163
-
4163
+
4164
4164
// similarity
4165
4165
check("similarity=XxX, vector_type=float, vector_dimension=1024, levels=3, clusters=10",
4166
4166
"Invalid similarity: xxx");
@@ -4182,7 +4182,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
4182
4182
"Invalid vector_type: 42");
4183
4183
check("similarity=inner_product, vector_dimension=1024, levels=3, clusters=10",
4184
4184
"vector_type should be set");
4185
-
4185
+
4186
4186
// vector_dimension
4187
4187
check("similarity=inner_product, vector_type=float, vector_dimension=XxX, levels=3, clusters=10",
4188
4188
"Invalid vector_dimension: xxx");
@@ -4199,7 +4199,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
4199
4199
"Invalid vector_dimension: 99999999999999999999");
4200
4200
check("similarity=inner_product, vector_type=float, levels=3, clusters=10",
4201
4201
"vector_dimension should be set");
4202
-
4202
+
4203
4203
// levels
4204
4204
check("similarity=inner_product, vector_type=float, vector_dimension=1024, levels=XxX, clusters=2",
4205
4205
"Invalid levels: xxx");
@@ -4235,13 +4235,13 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
4235
4235
"Invalid clusters: 99999999999999999999");
4236
4236
check("similarity=inner_product, vector_type=float, vector_dimension=1024, levels=1",
4237
4237
"clusters should be set");
4238
-
4238
+
4239
4239
// clusters^levels
4240
4240
check("similarity=inner_product, vector_type=float, vector_dimension=1024, levels=10, clusters=10",
4241
4241
"Invalid clusters^levels: 10^10 should be less than 1073741824");
4242
4242
check("similarity=inner_product, vector_type=float, vector_dimension=1024, levels=16, clusters=1024",
4243
4243
"Invalid clusters^levels: 1024^16 should be less than 1073741824");
4244
-
4244
+
4245
4245
// vector_dimension*clusters
4246
4246
check("similarity=inner_product, vector_type=float, vector_dimension=2048, levels=1, clusters=2048", "");
4247
4247
check("similarity=inner_product, vector_type=float, vector_dimension=2049, levels=1, clusters=2048",
@@ -11500,6 +11500,77 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
11500
11500
}
11501
11501
}
11502
11502
11503
+ Y_UNIT_TEST_TWIN(CreateAndAlterTopicAvailabilityPeriod, UseQueryService) {
11504
+ TKikimrRunner kikimr;
11505
+ auto queryClient = kikimr.GetQueryClient();
11506
+ auto db = kikimr.GetTableClient();
11507
+ auto session = db.CreateSession().GetValueSync().GetSession();
11508
+
11509
+ auto executeQuery = [&queryClient, &session](const TString& query) {
11510
+ return ExecuteGeneric<UseQueryService>(queryClient, session, query);
11511
+ };
11512
+
11513
+ // ok
11514
+ {
11515
+ const auto query = R"(
11516
+ --!syntax_v1
11517
+ CREATE TOPIC `/Root/topic` (
11518
+ CONSUMER cons1 WITH (availability_period = Interval('PT1H'))
11519
+ )
11520
+ )";
11521
+ const auto result = executeQuery(query);
11522
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
11523
+ }
11524
+ {
11525
+ const auto query = R"(
11526
+ --!syntax_v1
11527
+ ALTER TOPIC `/Root/topic`
11528
+ ALTER CONSUMER cons1 SET (availability_period = Interval('PT9H'))
11529
+ )";
11530
+ const auto result = executeQuery(query);
11531
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
11532
+ }
11533
+ {
11534
+ const auto query = R"(
11535
+ --!syntax_v1
11536
+ ALTER TOPIC `/Root/topic`
11537
+ DROP CONSUMER cons1,
11538
+ ADD CONSUMER cons2 WITH (availability_period = Interval('PT8H'))
11539
+ )";
11540
+ const auto result = executeQuery(query);
11541
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
11542
+ }
11543
+ {
11544
+ const auto query = R"(
11545
+ --!syntax_v1
11546
+ ALTER TOPIC `/Root/topic`
11547
+ ALTER CONSUMER cons2 RESET (availability_period)
11548
+ )";
11549
+ const auto result = executeQuery(query);
11550
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
11551
+ }
11552
+ // bad
11553
+ {
11554
+ const auto query = R"(
11555
+ --!syntax_v1
11556
+ ALTER TOPIC `/Root/topic`
11557
+ ALTER CONSUMER cons2 SET (availability_period = 0)
11558
+ )";
11559
+ const auto result = executeQuery(query);
11560
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::GENERIC_ERROR, result.GetIssues().ToString());
11561
+ UNIT_ASSERT_STRING_CONTAINS_C(result.GetIssues().ToString(), "Interval type is expected", result.GetIssues().ToString());
11562
+ }
11563
+ {
11564
+ const auto query = R"(
11565
+ --!syntax_v1
11566
+ ALTER TOPIC `/Root/topic`
11567
+ ADD CONSUMER cons_neg WITH (availability_period = Interval('-PT8H'))
11568
+ )";
11569
+ const auto result = executeQuery(query);
11570
+ UNIT_ASSERT_VALUES_UNEQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
11571
+ }
11572
+ }
11573
+
11503
11574
Y_UNIT_TEST(DisableResourcePools) {
11504
11575
NKikimrConfig::TAppConfig config;
11505
11576
config.MutableFeatureFlags()->SetEnableResourcePools(false);
0 commit comments