summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraidarsamer <[email protected]>2023-02-02 16:26:15 +0300
committeraidarsamer <[email protected]>2023-02-02 16:26:15 +0300
commitd9a051d043c63252e4178c8dfceab74bfffba606 (patch)
tree1c50acc459bee9372da284a0a34864322da7db21
parent3ab73051c7be1c54749f57cd7cdde04eedaf0ab3 (diff)
Enable plan verification for ClickBenchSmoke tests
-rw-r--r--ydb/core/kqp/ut/olap/kqp_olap_ut.cpp76
1 files changed, 70 insertions, 6 deletions
diff --git a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp
index 43e4dd254e8..0209be00352 100644
--- a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp
+++ b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp
@@ -178,6 +178,27 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
UNIT_ASSERT_VALUES_EQUAL_C(resCommitTx.Status().GetStatus(), EStatus::SUCCESS, resCommitTx.Status().GetIssues().ToString());
}
+ void WriteTestDataForClickBench(TKikimrRunner& kikimr, TString testTable, ui64 pathIdBegin, ui64 tsBegin, size_t rowCount) {
+ UNIT_ASSERT(testTable == "/Root/benchTable"); // TODO: check schema instead
+
+ TClickHelper lHelper(kikimr.GetTestServer());
+ NYdb::NLongTx::TClient client(kikimr.GetDriver());
+
+ NLongTx::TLongTxBeginResult resBeginTx = client.BeginWriteTx().GetValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(resBeginTx.Status().GetStatus(), EStatus::SUCCESS, resBeginTx.Status().GetIssues().ToString());
+
+ auto txId = resBeginTx.GetResult().tx_id();
+ auto batch = lHelper.TestArrowBatch(pathIdBegin, tsBegin, rowCount);
+ TString data = NArrow::SerializeBatchNoCompression(batch);
+
+ NLongTx::TLongTxWriteResult resWrite =
+ client.Write(txId, testTable, txId, data, Ydb::LongTx::Data::APACHE_ARROW).GetValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(resWrite.Status().GetStatus(), EStatus::SUCCESS, resWrite.Status().GetIssues().ToString());
+
+ NLongTx::TLongTxCommitResult resCommitTx = client.CommitTx(txId).GetValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(resCommitTx.Status().GetStatus(), EStatus::SUCCESS, resCommitTx.Status().GetIssues().ToString());
+ }
+
void WriteTestDataForTableWithNulls(TKikimrRunner& kikimr, TString testTable) {
UNIT_ASSERT(testTable == "/Root/tableWithNulls"); // TODO: check schema instead
TTableWithNullsHelper lHelper(kikimr.GetTestServer());
@@ -1637,7 +1658,38 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
TestAggregationsInternal(cases);
}
- void TestClickBench(const std::vector<TAggregationTestCase>& cases) {
+ void TestClickBenchBase(const std::vector<TAggregationTestCase>& cases) {
+ auto settings = TKikimrSettings()
+ .SetWithSampleTables(false)
+ .SetEnableOlapSchemaOperations(true);
+ TKikimrRunner kikimr(settings);
+
+ EnableDebugLogging(kikimr);
+ TClickHelper(kikimr).CreateClickBenchTable();
+ auto tableClient = kikimr.GetTableClient();
+
+
+ ui32 numIterations = 10;
+ const ui32 iterationPackSize = 2000;
+ for (ui64 i = 0; i < numIterations; ++i) {
+ WriteTestDataForClickBench(kikimr, "/Root/benchTable", 0, 1000000 + i * 1000000, iterationPackSize);
+ }
+
+ for (auto&& i : cases) {
+ const TString queryFixed = i.GetFixedQuery();
+ {
+ auto it = tableClient.StreamExecuteScanQuery(queryFixed).GetValueSync();
+ UNIT_ASSERT_C(it.IsSuccess(), it.GetIssues().ToString());
+ TString result = StreamResultToYson(it);
+ if (!i.GetExpectedReply().empty()) {
+ CompareYson(result, i.GetExpectedReply());
+ }
+ }
+ CheckPlanForAggregatePushdown(queryFixed, tableClient, i.GetExpectedPlanOptions(), i.GetExpectedReadNodeType());
+ }
+ }
+
+ void TestClickBenchInternal(const std::vector<TAggregationTestCase>& cases) {
TPortManager tp;
ui16 mbusport = tp.GetPort(2134);
auto settings = Tests::TServerSettings(mbusport)
@@ -1697,6 +1749,11 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
}
}
+ void TestClickBench(const std::vector<TAggregationTestCase>& cases) {
+ TestClickBenchBase(cases);
+ TestClickBenchInternal(cases);
+ }
+
void TestTableWithNulls(const std::vector<TAggregationTestCase>& cases) {
auto settings = TKikimrSettings()
.SetWithSampleTables(false)
@@ -2541,7 +2598,9 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
ORDER BY c DESC
)")
//.SetExpectedReply("[[[\"40999\"];[4];1u];[[\"40998\"];[3];1u];[[\"40997\"];[2];1u]]")
- .SetExpectedReadNodeType("TableFullScan");
+ // Should be fixed in https://st.yandex-team.ru/KIKIMR-17009
+ // .SetExpectedReadNodeType("TableFullScan");
+ .SetExpectedReadNodeType("Aggregate-TableFullScan");
;
q7.FillExpectedAggregationGroupByPlanOptions();
@@ -2555,7 +2614,9 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
LIMIT 10
)")
//.SetExpectedReply("[[[\"40999\"];[4];1u];[[\"40998\"];[3];1u];[[\"40997\"];[2];1u]]")
- .SetExpectedReadNodeType("TableFullScan");
+ // Should be fixed in https://st.yandex-team.ru/KIKIMR-17009
+ // .SetExpectedReadNodeType("TableFullScan");
+ .SetExpectedReadNodeType("Aggregate-TableFullScan");
q9.FillExpectedAggregationGroupByPlanOptions();
TAggregationTestCase q12;
@@ -2569,8 +2630,9 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
LIMIT 10;
)")
//.SetExpectedReply("[[[\"40999\"];[4];1u];[[\"40998\"];[3];1u];[[\"40997\"];[2];1u]]")
- .AddExpectedPlanOptions("TKqpOlapAgg")
- .SetExpectedReadNodeType("TableFullScan");
+ // Should be fixed in https://st.yandex-team.ru/KIKIMR-17009
+ // .SetExpectedReadNodeType("TableFullScan");
+ .SetExpectedReadNodeType("Aggregate-TableFullScan");
q12.FillExpectedAggregationGroupByPlanOptions();
TAggregationTestCase q14;
@@ -2584,7 +2646,9 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
LIMIT 10;
)")
//.SetExpectedReply("[[[\"40999\"];[4];1u];[[\"40998\"];[3];1u];[[\"40997\"];[2];1u]]")
- .SetExpectedReadNodeType("TableFullScan");
+ // Should be fixed in https://st.yandex-team.ru/KIKIMR-17009
+ // .SetExpectedReadNodeType("TableFullScan");
+ .SetExpectedReadNodeType("Aggregate-TableFullScan");
q14.FillExpectedAggregationGroupByPlanOptions();
TestClickBench({ q7, q9, q12, q14 });