@@ -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
}
@@ -3541,6 +3528,96 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
3541
3528
}
3542
3529
}
3543
3530
3531
+ Y_UNIT_TEST (ReadDatashardAndColumnshard) {
3532
+ NKikimrConfig::TAppConfig appConfig;
3533
+ appConfig.MutableTableServiceConfig ()->SetEnableOlapSink (true );
3534
+ appConfig.MutableTableServiceConfig ()->SetEnableOltpSink (true );
3535
+ auto settings = TKikimrSettings ()
3536
+ .SetAppConfig (appConfig)
3537
+ .SetWithSampleTables (false );
3538
+
3539
+ TKikimrRunner kikimr (settings);
3540
+ Tests::NCommon::TLoggerInit (kikimr).Initialize ();
3541
+
3542
+ auto client = kikimr.GetQueryClient ();
3543
+
3544
+ {
3545
+ auto createTable = client.ExecuteQuery (R"sql(
3546
+ CREATE TABLE `/Root/DataShard` (
3547
+ Col1 Uint64 NOT NULL,
3548
+ Col2 Int32,
3549
+ Col3 String,
3550
+ PRIMARY KEY (Col1)
3551
+ ) WITH (
3552
+ STORE = ROW,
3553
+ AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 10
3554
+ );
3555
+ CREATE TABLE `/Root/ColumnShard` (
3556
+ Col1 Uint64 NOT NULL,
3557
+ Col2 Int32,
3558
+ Col3 String,
3559
+ PRIMARY KEY (Col1)
3560
+ ) WITH (
3561
+ STORE = COLUMN,
3562
+ AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 10
3563
+ );
3564
+ )sql" , NYdb::NQuery::TTxControl::NoTx ()).ExtractValueSync ();
3565
+ UNIT_ASSERT_C (createTable.IsSuccess (), createTable.GetIssues ().ToString ());
3566
+ }
3567
+
3568
+ {
3569
+ auto replaceValues = client.ExecuteQuery (R"sql(
3570
+ REPLACE INTO `/Root/DataShard` (Col1, Col2, Col3) VALUES
3571
+ (1u, 1, "row");
3572
+ )sql" , NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
3573
+ UNIT_ASSERT_C (replaceValues.IsSuccess (), replaceValues.GetIssues ().ToString ());
3574
+ }
3575
+
3576
+ {
3577
+ auto replaceValues = client.ExecuteQuery (R"sql(
3578
+ REPLACE INTO `/Root/ColumnShard` (Col1, Col2, Col3) VALUES
3579
+ (2u, 2, "column");
3580
+ )sql" , NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
3581
+ UNIT_ASSERT_C (replaceValues.IsSuccess (), replaceValues.GetIssues ().ToString ());
3582
+ }
3583
+
3584
+ {
3585
+ auto it = client.StreamExecuteQuery (R"sql(
3586
+ SELECT * FROM `/Root/ColumnShard`;
3587
+ )sql" , NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
3588
+ UNIT_ASSERT_VALUES_EQUAL_C (it.GetStatus (), EStatus::SUCCESS, it.GetIssues ().ToString ());
3589
+ TString output = StreamResultToYson (it);
3590
+ CompareYson (
3591
+ output,
3592
+ R"( [[2u;[2];["column"]]])" );
3593
+ }
3594
+
3595
+ {
3596
+ auto it = client.StreamExecuteQuery (R"sql(
3597
+ SELECT * FROM `/Root/DataShard`
3598
+ UNION ALL
3599
+ SELECT * FROM `/Root/ColumnShard`;
3600
+ )sql" , NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
3601
+ UNIT_ASSERT_VALUES_EQUAL_C (it.GetStatus (), EStatus::SUCCESS, it.GetIssues ().ToString ());
3602
+ TString output = StreamResultToYson (it);
3603
+ CompareYson (
3604
+ output,
3605
+ R"( [[1u;[1];["row"]];[2u;[2];["column"]]])" );
3606
+ }
3607
+
3608
+ {
3609
+ auto it = client.StreamExecuteQuery (R"sql(
3610
+ SELECT r.Col3, c.Col3 FROM `/Root/DataShard` AS r
3611
+ JOIN `/Root/ColumnShard` AS c ON r.Col1 + 1 = c.Col1;
3612
+ )sql" , NYdb::NQuery::TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
3613
+ UNIT_ASSERT_VALUES_EQUAL_C (it.GetStatus (), EStatus::SUCCESS, it.GetIssues ().ToString ());
3614
+ TString output = StreamResultToYson (it);
3615
+ CompareYson (
3616
+ output,
3617
+ R"( [[["row"];["column"]]])" );
3618
+ }
3619
+ }
3620
+
3544
3621
Y_UNIT_TEST (ReplaceIntoWithDefaultValue) {
3545
3622
NKikimrConfig::TAppConfig appConfig;
3546
3623
appConfig.MutableTableServiceConfig ()->SetEnableOlapSink (false );
0 commit comments