Skip to content

Commit 43eb80e

Browse files
authored
enable UUID pk for 24.3 (#8018)
1 parent 4a7f723 commit 43eb80e

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,8 +1947,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
19471947
}
19481948

19491949
Y_UNIT_TEST(CreateTableWithPartitionAtKeysUuid) {
1950-
TKikimrSettings kikimrSettings = TKikimrSettings()
1951-
.SetEnableUuidAsPrimaryKey(true);
1950+
TKikimrSettings kikimrSettings;
19521951
TKikimrRunner kikimr(kikimrSettings);
19531952
auto db = kikimr.GetTableClient();
19541953
auto session = db.CreateSession().GetValueSync().GetSession();
@@ -1992,8 +1991,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
19921991
}
19931992

19941993
Y_UNIT_TEST(CreateTableWithUniformPartitionsUuid) {
1995-
TKikimrSettings kikimrSettings = TKikimrSettings()
1996-
.SetEnableUuidAsPrimaryKey(true);
1994+
TKikimrSettings kikimrSettings;
19971995
TKikimrRunner kikimr(kikimrSettings);
19981996
auto db = kikimr.GetTableClient();
19991997
auto session = db.CreateSession().GetValueSync().GetSession();

ydb/core/kqp/ut/yql/kqp_yql_ut.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ Y_UNIT_TEST_SUITE(KqpYql) {
613613
appConfig.MutableTableServiceConfig()->SetEnablePreparedDdl(true);
614614
auto setting = NKikimrKqp::TKqpSetting();
615615
auto serverSettings = TKikimrSettings()
616+
.SetEnableUuidAsPrimaryKey(false)
616617
.SetAppConfig(appConfig)
617618
.SetKqpSettings({setting});
618619
TKikimrRunner kikimr(serverSettings.SetWithSampleTables(false));
@@ -684,7 +685,6 @@ Y_UNIT_TEST_SUITE(KqpYql) {
684685
auto setting = NKikimrKqp::TKqpSetting();
685686
auto serverSettings = TKikimrSettings()
686687
.SetAppConfig(appConfig)
687-
.SetEnableUuidAsPrimaryKey(true)
688688
.SetKqpSettings({setting});
689689
TKikimrRunner kikimr(serverSettings.SetWithSampleTables(false));
690690

@@ -833,7 +833,6 @@ Y_UNIT_TEST_SUITE(KqpYql) {
833833
auto setting = NKikimrKqp::TKqpSetting();
834834
auto serverSettings = TKikimrSettings()
835835
.SetAppConfig(appConfig)
836-
.SetEnableUuidAsPrimaryKey(true)
837836
.SetKqpSettings({setting});
838837
TKikimrRunner kikimr(serverSettings.SetWithSampleTables(false));
839838

@@ -890,7 +889,6 @@ Y_UNIT_TEST_SUITE(KqpYql) {
890889
auto setting = NKikimrKqp::TKqpSetting();
891890
auto serverSettings = TKikimrSettings()
892891
.SetAppConfig(appConfig)
893-
.SetEnableUuidAsPrimaryKey(true)
894892
.SetKqpSettings({setting});
895893
TKikimrRunner kikimr(serverSettings.SetWithSampleTables(false));
896894

@@ -917,7 +915,6 @@ Y_UNIT_TEST_SUITE(KqpYql) {
917915

918916
Y_UNIT_TEST(UuidPrimaryKeyBulkUpsert) {
919917
auto settings = TKikimrSettings()
920-
.SetEnableUuidAsPrimaryKey(true)
921918
.SetWithSampleTables(false);
922919
auto kikimr = TKikimrRunner{settings};
923920
auto db = kikimr.GetTableClient();

ydb/core/protos/feature_flags.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ message TFeatureFlags {
119119
optional bool EnableUniqConstraint = 104 [default = false];
120120
optional bool EnableChangefeedDebeziumJsonFormat = 105 [default = false];
121121
optional bool EnableStatistics = 106 [default = false];
122-
optional bool EnableUuidAsPrimaryKey = 107 [default = false];
122+
optional bool EnableUuidAsPrimaryKey = 107 [default = true];
123123
optional bool EnableTablePgTypes = 108 [default = false];
124124
optional bool EnableLocalDBBtreeIndex = 109 [default = false];
125125
optional bool EnablePDiskHighHDDInFlight = 110 [default = false];

ydb/tests/functional/replication/main.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ Y_UNIT_TEST_SUITE(Replication)
4242
auto res = session.ExecuteSchemeQuery(R"(
4343
CREATE TABLE `/local/ProducerUuidValue` (
4444
Key Uint32,
45+
Key2 Uuid,
4546
v01 Uuid,
4647
v02 Uuid NOT NULL,
4748
v03 Double,
48-
PRIMARY KEY (Key)
49+
PRIMARY KEY (Key, Key2)
4950
);
5051
)").GetValueSync();
5152
UNIT_ASSERT_C(res.IsSuccess(), res.GetIssues().ToString());
@@ -57,8 +58,9 @@ Y_UNIT_TEST_SUITE(Replication)
5758
auto s = sessionResult.GetSession();
5859

5960
{
60-
const TString query = "UPSERT INTO ProducerUuidValue (Key,v01,v02,v03) VALUES"
61+
const TString query = "UPSERT INTO ProducerUuidValue (Key,Key2,v01,v02,v03) VALUES"
6162
"(1, "
63+
"CAST(\"5b99a330-04ef-4f1a-9b64-ba6d5f44ea00\" as Uuid), "
6264
"CAST(\"5b99a330-04ef-4f1a-9b64-ba6d5f44ea01\" as Uuid), "
6365
"UNWRAP(CAST(\"5b99a330-04ef-4f1a-9b64-ba6d5f44ea02\" as Uuid)), "
6466
"CAST(\"311111111113.222222223\" as Double) "
@@ -88,6 +90,7 @@ Y_UNIT_TEST_SUITE(Replication)
8890
UNIT_ASSERT_C(sessionResult.IsSuccess(), sessionResult.GetIssues().ToString());
8991

9092
auto s = sessionResult.GetSession();
93+
TUuidValue expectedKey2("5b99a330-04ef-4f1a-9b64-ba6d5f44ea00");
9194
TUuidValue expectedV1("5b99a330-04ef-4f1a-9b64-ba6d5f44ea01");
9295
TUuidValue expectedV2("5b99a330-04ef-4f1a-9b64-ba6d5f44ea02");
9396
double expectedV3 = 311111111113.222222223;
@@ -97,11 +100,13 @@ Y_UNIT_TEST_SUITE(Replication)
97100
if (res.first == 1) {
98101
const Ydb::ResultSet& proto = res.second;
99102
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(0).uint32_value(), 1);
100-
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).low_128(), expectedV1.Buf_.Halfs[0]);
101-
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).high_128(), expectedV1.Buf_.Halfs[1]);
102-
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).low_128(), expectedV2.Buf_.Halfs[0]);
103-
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).high_128(), expectedV2.Buf_.Halfs[1]);
104-
UNIT_ASSERT_DOUBLES_EQUAL(proto.rows(0).items(3).double_value(), expectedV3, 0.0001);
103+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).low_128(), expectedKey2.Buf_.Halfs[0]);
104+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).high_128(), expectedKey2.Buf_.Halfs[1]);
105+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).low_128(), expectedV1.Buf_.Halfs[0]);
106+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).high_128(), expectedV1.Buf_.Halfs[1]);
107+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(3).low_128(), expectedV2.Buf_.Halfs[0]);
108+
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(3).high_128(), expectedV2.Buf_.Halfs[1]);
109+
UNIT_ASSERT_DOUBLES_EQUAL(proto.rows(0).items(4).double_value(), expectedV3, 0.0001);
105110
break;
106111
}
107112
Sleep(TDuration::Seconds(1));

0 commit comments

Comments
 (0)