Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable UUID pk for 24.3 #8018

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1947,8 +1947,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
}

Y_UNIT_TEST(CreateTableWithPartitionAtKeysUuid) {
TKikimrSettings kikimrSettings = TKikimrSettings()
.SetEnableUuidAsPrimaryKey(true);
TKikimrSettings kikimrSettings;
TKikimrRunner kikimr(kikimrSettings);
auto db = kikimr.GetTableClient();
auto session = db.CreateSession().GetValueSync().GetSession();
Expand Down Expand Up @@ -1992,8 +1991,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
}

Y_UNIT_TEST(CreateTableWithUniformPartitionsUuid) {
TKikimrSettings kikimrSettings = TKikimrSettings()
.SetEnableUuidAsPrimaryKey(true);
TKikimrSettings kikimrSettings;
TKikimrRunner kikimr(kikimrSettings);
auto db = kikimr.GetTableClient();
auto session = db.CreateSession().GetValueSync().GetSession();
Expand Down
5 changes: 1 addition & 4 deletions ydb/core/kqp/ut/yql/kqp_yql_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ Y_UNIT_TEST_SUITE(KqpYql) {
appConfig.MutableTableServiceConfig()->SetEnablePreparedDdl(true);
auto setting = NKikimrKqp::TKqpSetting();
auto serverSettings = TKikimrSettings()
.SetEnableUuidAsPrimaryKey(false)
.SetAppConfig(appConfig)
.SetKqpSettings({setting});
TKikimrRunner kikimr(serverSettings.SetWithSampleTables(false));
Expand Down Expand Up @@ -684,7 +685,6 @@ Y_UNIT_TEST_SUITE(KqpYql) {
auto setting = NKikimrKqp::TKqpSetting();
auto serverSettings = TKikimrSettings()
.SetAppConfig(appConfig)
.SetEnableUuidAsPrimaryKey(true)
.SetKqpSettings({setting});
TKikimrRunner kikimr(serverSettings.SetWithSampleTables(false));

Expand Down Expand Up @@ -833,7 +833,6 @@ Y_UNIT_TEST_SUITE(KqpYql) {
auto setting = NKikimrKqp::TKqpSetting();
auto serverSettings = TKikimrSettings()
.SetAppConfig(appConfig)
.SetEnableUuidAsPrimaryKey(true)
.SetKqpSettings({setting});
TKikimrRunner kikimr(serverSettings.SetWithSampleTables(false));

Expand Down Expand Up @@ -890,7 +889,6 @@ Y_UNIT_TEST_SUITE(KqpYql) {
auto setting = NKikimrKqp::TKqpSetting();
auto serverSettings = TKikimrSettings()
.SetAppConfig(appConfig)
.SetEnableUuidAsPrimaryKey(true)
.SetKqpSettings({setting});
TKikimrRunner kikimr(serverSettings.SetWithSampleTables(false));

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

Y_UNIT_TEST(UuidPrimaryKeyBulkUpsert) {
auto settings = TKikimrSettings()
.SetEnableUuidAsPrimaryKey(true)
.SetWithSampleTables(false);
auto kikimr = TKikimrRunner{settings};
auto db = kikimr.GetTableClient();
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/protos/feature_flags.proto
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ message TFeatureFlags {
optional bool EnableUniqConstraint = 104 [default = false];
optional bool EnableChangefeedDebeziumJsonFormat = 105 [default = false];
optional bool EnableStatistics = 106 [default = false];
optional bool EnableUuidAsPrimaryKey = 107 [default = false];
optional bool EnableUuidAsPrimaryKey = 107 [default = true];
optional bool EnableTablePgTypes = 108 [default = false];
optional bool EnableLocalDBBtreeIndex = 109 [default = false];
optional bool EnablePDiskHighHDDInFlight = 110 [default = false];
Expand Down
19 changes: 12 additions & 7 deletions ydb/tests/functional/replication/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ Y_UNIT_TEST_SUITE(Replication)
auto res = session.ExecuteSchemeQuery(R"(
CREATE TABLE `/local/ProducerUuidValue` (
Key Uint32,
Key2 Uuid,
v01 Uuid,
v02 Uuid NOT NULL,
v03 Double,
PRIMARY KEY (Key)
PRIMARY KEY (Key, Key2)
);
)").GetValueSync();
UNIT_ASSERT_C(res.IsSuccess(), res.GetIssues().ToString());
Expand All @@ -57,8 +58,9 @@ Y_UNIT_TEST_SUITE(Replication)
auto s = sessionResult.GetSession();

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

auto s = sessionResult.GetSession();
TUuidValue expectedKey2("5b99a330-04ef-4f1a-9b64-ba6d5f44ea00");
TUuidValue expectedV1("5b99a330-04ef-4f1a-9b64-ba6d5f44ea01");
TUuidValue expectedV2("5b99a330-04ef-4f1a-9b64-ba6d5f44ea02");
double expectedV3 = 311111111113.222222223;
Expand All @@ -97,11 +100,13 @@ Y_UNIT_TEST_SUITE(Replication)
if (res.first == 1) {
const Ydb::ResultSet& proto = res.second;
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(0).uint32_value(), 1);
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).low_128(), expectedV1.Buf_.Halfs[0]);
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).high_128(), expectedV1.Buf_.Halfs[1]);
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).low_128(), expectedV2.Buf_.Halfs[0]);
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).high_128(), expectedV2.Buf_.Halfs[1]);
UNIT_ASSERT_DOUBLES_EQUAL(proto.rows(0).items(3).double_value(), expectedV3, 0.0001);
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).low_128(), expectedKey2.Buf_.Halfs[0]);
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(1).high_128(), expectedKey2.Buf_.Halfs[1]);
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).low_128(), expectedV1.Buf_.Halfs[0]);
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(2).high_128(), expectedV1.Buf_.Halfs[1]);
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(3).low_128(), expectedV2.Buf_.Halfs[0]);
UNIT_ASSERT_VALUES_EQUAL(proto.rows(0).items(3).high_128(), expectedV2.Buf_.Halfs[1]);
UNIT_ASSERT_DOUBLES_EQUAL(proto.rows(0).items(4).double_value(), expectedV3, 0.0001);
break;
}
Sleep(TDuration::Seconds(1));
Expand Down
Loading