@@ -2790,7 +2790,7 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
2790
2790
auto insertResult = client.ExecuteQuery (sql, NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).GetValueSync ();
2791
2791
UNIT_ASSERT (!insertResult.IsSuccess ());
2792
2792
UNIT_ASSERT_C (
2793
- insertResult.GetIssues ().ToString ().Contains (" Transactions between column and row tables are disabled at current time" ),
2793
+ insertResult.GetIssues ().ToString ().Contains (" Write transactions between column and row tables are disabled at current time" ),
2794
2794
insertResult.GetIssues ().ToString ());
2795
2795
}
2796
2796
@@ -2803,20 +2803,7 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
2803
2803
auto insertResult = client.ExecuteQuery (sql, NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).GetValueSync ();
2804
2804
UNIT_ASSERT (!insertResult.IsSuccess ());
2805
2805
UNIT_ASSERT_C (
2806
- insertResult.GetIssues ().ToString ().Contains (" Transactions between column and row tables are disabled at current time" ),
2807
- insertResult.GetIssues ().ToString ());
2808
- }
2809
-
2810
- {
2811
- // column & row read
2812
- const TString sql = R"(
2813
- SELECT * FROM `/Root/DataShard`;
2814
- SELECT * FROM `/Root/ColumnShard`;
2815
- )" ;
2816
- auto insertResult = client.ExecuteQuery (sql, NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).GetValueSync ();
2817
- UNIT_ASSERT (!insertResult.IsSuccess ());
2818
- UNIT_ASSERT_C (
2819
- insertResult.GetIssues ().ToString ().Contains (" Transactions between column and row tables are disabled at current time" ),
2806
+ insertResult.GetIssues ().ToString ().Contains (" Write transactions between column and row tables are disabled at current time" ),
2820
2807
insertResult.GetIssues ().ToString ());
2821
2808
}
2822
2809
@@ -2831,7 +2818,7 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
2831
2818
auto insertResult = client.ExecuteQuery (sql, NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).GetValueSync ();
2832
2819
UNIT_ASSERT (!insertResult.IsSuccess ());
2833
2820
UNIT_ASSERT_C (
2834
- insertResult.GetIssues ().ToString ().Contains (" Transactions between column and row tables are disabled at current time" ),
2821
+ insertResult.GetIssues ().ToString ().Contains (" Write transactions between column and row tables are disabled at current time" ),
2835
2822
insertResult.GetIssues ().ToString ());
2836
2823
}
2837
2824
@@ -2845,7 +2832,7 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
2845
2832
auto insertResult = client.ExecuteQuery (sql, NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).GetValueSync ();
2846
2833
UNIT_ASSERT (!insertResult.IsSuccess ());
2847
2834
UNIT_ASSERT_C (
2848
- insertResult.GetIssues ().ToString ().Contains (" Transactions between column and row tables are disabled at current time" ),
2835
+ insertResult.GetIssues ().ToString ().Contains (" Write transactions between column and row tables are disabled at current time" ),
2849
2836
insertResult.GetIssues ().ToString ());
2850
2837
}
2851
2838
@@ -2859,7 +2846,7 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
2859
2846
auto insertResult = client.ExecuteQuery (sql, NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).GetValueSync ();
2860
2847
UNIT_ASSERT (!insertResult.IsSuccess ());
2861
2848
UNIT_ASSERT_C (
2862
- insertResult.GetIssues ().ToString ().Contains (" Transactions between column and row tables are disabled at current time" ),
2849
+ insertResult.GetIssues ().ToString ().Contains (" Write transactions between column and row tables are disabled at current time" ),
2863
2850
insertResult.GetIssues ().ToString ());
2864
2851
}
2865
2852
}
@@ -3533,6 +3520,96 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
3533
3520
}
3534
3521
}
3535
3522
3523
+ Y_UNIT_TEST (ReadDatashardAndColumnshard) {
3524
+ NKikimrConfig::TAppConfig appConfig;
3525
+ appConfig.MutableTableServiceConfig ()->SetEnableOlapSink (true );
3526
+ appConfig.MutableTableServiceConfig ()->SetEnableOltpSink (true );
3527
+ auto settings = TKikimrSettings ()
3528
+ .SetAppConfig (appConfig)
3529
+ .SetWithSampleTables (false );
3530
+
3531
+ TKikimrRunner kikimr (settings);
3532
+ Tests::NCommon::TLoggerInit (kikimr).Initialize ();
3533
+
3534
+ auto client = kikimr.GetQueryClient ();
3535
+
3536
+ {
3537
+ auto createTable = client.ExecuteQuery (R"sql(
3538
+ CREATE TABLE `/Root/DataShard` (
3539
+ Col1 Uint64 NOT NULL,
3540
+ Col2 Int32,
3541
+ Col3 String,
3542
+ PRIMARY KEY (Col1)
3543
+ ) WITH (
3544
+ STORE = ROW,
3545
+ AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 10
3546
+ );
3547
+ CREATE TABLE `/Root/ColumnShard` (
3548
+ Col1 Uint64 NOT NULL,
3549
+ Col2 Int32,
3550
+ Col3 String,
3551
+ PRIMARY KEY (Col1)
3552
+ ) WITH (
3553
+ STORE = COLUMN,
3554
+ AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 10
3555
+ );
3556
+ )sql" , NYdb::NQuery::TTxControl::NoTx ()).ExtractValueSync ();
3557
+ UNIT_ASSERT_C (createTable.IsSuccess (), createTable.GetIssues ().ToString ());
3558
+ }
3559
+
3560
+ {
3561
+ auto replaceValues = client.ExecuteQuery (R"sql(
3562
+ REPLACE INTO `/Root/DataShard` (Col1, Col2, Col3) VALUES
3563
+ (1u, 1, "row");
3564
+ )sql" , NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
3565
+ UNIT_ASSERT_C (replaceValues.IsSuccess (), replaceValues.GetIssues ().ToString ());
3566
+ }
3567
+
3568
+ {
3569
+ auto replaceValues = client.ExecuteQuery (R"sql(
3570
+ REPLACE INTO `/Root/ColumnShard` (Col1, Col2, Col3) VALUES
3571
+ (2u, 2, "column");
3572
+ )sql" , NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
3573
+ UNIT_ASSERT_C (replaceValues.IsSuccess (), replaceValues.GetIssues ().ToString ());
3574
+ }
3575
+
3576
+ {
3577
+ auto it = client.StreamExecuteQuery (R"sql(
3578
+ SELECT * FROM `/Root/ColumnShard`;
3579
+ )sql" , NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
3580
+ UNIT_ASSERT_VALUES_EQUAL_C (it.GetStatus (), EStatus::SUCCESS, it.GetIssues ().ToString ());
3581
+ TString output = StreamResultToYson (it);
3582
+ CompareYson (
3583
+ output,
3584
+ R"( [[2u;[2];["column"]]])" );
3585
+ }
3586
+
3587
+ {
3588
+ auto it = client.StreamExecuteQuery (R"sql(
3589
+ SELECT * FROM `/Root/DataShard`
3590
+ UNION ALL
3591
+ SELECT * FROM `/Root/ColumnShard`;
3592
+ )sql" , NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
3593
+ UNIT_ASSERT_VALUES_EQUAL_C (it.GetStatus (), EStatus::SUCCESS, it.GetIssues ().ToString ());
3594
+ TString output = StreamResultToYson (it);
3595
+ CompareYson (
3596
+ output,
3597
+ R"( [[1u;[1];["row"]];[2u;[2];["column"]]])" );
3598
+ }
3599
+
3600
+ {
3601
+ auto it = client.StreamExecuteQuery (R"sql(
3602
+ SELECT r.Col3, c.Col3 FROM `/Root/DataShard` AS r
3603
+ JOIN `/Root/ColumnShard` AS c ON r.Col1 + 1 = c.Col1;
3604
+ )sql" , NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
3605
+ UNIT_ASSERT_VALUES_EQUAL_C (it.GetStatus (), EStatus::SUCCESS, it.GetIssues ().ToString ());
3606
+ TString output = StreamResultToYson (it);
3607
+ CompareYson (
3608
+ output,
3609
+ R"( [[["row"];["column"]]])" );
3610
+ }
3611
+ }
3612
+
3536
3613
Y_UNIT_TEST (ReplaceIntoWithDefaultValue) {
3537
3614
NKikimrConfig::TAppConfig appConfig;
3538
3615
appConfig.MutableTableServiceConfig ()->SetEnableOlapSink (false );
0 commit comments