diff options
author | Vladislav Kuznetsov <va.kuznecov@physics.msu.ru> | 2022-07-05 12:47:11 +0300 |
---|---|---|
committer | Vladislav Kuznetsov <va.kuznecov@physics.msu.ru> | 2022-07-05 12:47:11 +0300 |
commit | 871d290e1321d5a6c7d93774ae1091d50f322d75 (patch) | |
tree | 40e5f98097ac69a8e267aa8b89b1a94b37d06bc4 | |
parent | 558576e27224cc633b5e7748f8b8deaa773baa97 (diff) | |
download | ydb-871d290e1321d5a6c7d93774ae1091d50f322d75.tar.gz |
Add ut for concurrent execution of same requests KIKIMR-13807
ref:c22f3862335e6549d01a386eda97369b2fa4ed0c
-rw-r--r-- | ydb/core/kqp/ut/kqp_service_ut.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ydb/core/kqp/ut/kqp_service_ut.cpp b/ydb/core/kqp/ut/kqp_service_ut.cpp index 5d9bcd5074e..87f47a45ab9 100644 --- a/ydb/core/kqp/ut/kqp_service_ut.cpp +++ b/ydb/core/kqp/ut/kqp_service_ut.cpp @@ -228,6 +228,40 @@ Y_UNIT_TEST_SUITE(KqpService) { UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::SUCCESS, status.GetIssues().ToString()); } + Y_UNIT_TEST_TWIN(PatternCache, UseLLVM) { + auto settings = TKikimrSettings() + .SetWithSampleTables(false); + auto kikimr = TKikimrRunner{settings}; + auto driver = kikimr.GetDriver(); + + size_t InFlight = 3; + NPar::LocalExecutor().RunAdditionalThreads(InFlight); + NPar::LocalExecutor().ExecRange([&driver](int /*id*/) { + NYdb::NTable::TTableClient db(driver); + auto session = db.CreateSession().GetValueSync().GetSession(); + for (ui32 i = 0; i < 100; ++i) { + ui64 total = 100500; + TString request = (TStringBuilder() << R"_( + $data = AsList( + AsStruct("aaa" AS Key,)_" << i / 5 << R"_(u AS Value), + AsStruct("aaa" AS Key,)_" << i / 5 << R"_(u AS Value), + AsStruct("aaa" AS Key,)_" << total - 2 * (i / 5) << R"_(u AS Value) + ); + + SELECT Key, SUM(Value) as Sum FROM AS_TABLE($data) GROUP BY Key; + )_"); + + auto result = session.ExecuteDataQuery(request, TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync(); + AssertSuccessResult(result); + + CompareYson(R"( + [ + ["aaa";100500u] + ] + )", FormatResultSetYson(result.GetResultSet(0))); + } + }, 0, InFlight, NPar::TLocalExecutor::WAIT_COMPLETE | NPar::TLocalExecutor::MED_PRIORITY); + } } } // namspace NKqp |