diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2022-06-10 08:26:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2022-06-10 08:26:52 +0300 |
commit | 3b33e3977392a5e61f80c359c5d5bac0430676c4 (patch) | |
tree | ccf433f3d4d2bfc9897b99b6c1a9fe005babfc9c | |
parent | 7d8f5164c5a57e3986bc9c838272cb23bf2214a8 (diff) | |
download | ydb-3b33e3977392a5e61f80c359c5d5bac0430676c4.tar.gz |
ut to use index with scripting service. KIKIMR-15065
ref:48118a787f3dab508f4cbff14e513f97ca045f4f
-rw-r--r-- | ydb/core/kqp/ut/kqp_indexes_ut.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/ydb/core/kqp/ut/kqp_indexes_ut.cpp b/ydb/core/kqp/ut/kqp_indexes_ut.cpp index 39be9e8e0d7..61327295c7b 100644 --- a/ydb/core/kqp/ut/kqp_indexes_ut.cpp +++ b/ydb/core/kqp/ut/kqp_indexes_ut.cpp @@ -2454,6 +2454,47 @@ Y_UNIT_TEST_SUITE(KqpIndexes) { } } + Y_UNIT_TEST_QUAD(SecondaryIndexSelectUsingScripting, WithMvcc, UseNewEngine) { + auto setting = NKikimrKqp::TKqpSetting(); + auto serverSettings = TKikimrSettings() + .SetEnableMvcc(WithMvcc) + .SetEnableMvccSnapshotReads(WithMvcc) + .SetKqpSettings({setting}); + TKikimrRunner kikimr(serverSettings); + auto db = kikimr.GetTableClient(); + TScriptingClient client(kikimr.GetDriver()); + { + auto session = db.CreateSession().GetValueSync().GetSession(); + const TString createTableSql(R"( + --!syntax_v1 + CREATE TABLE `/Root/SharedHouseholds` ( + guest_huid Uint64, guest_id Uint64, owner_huid Uint64, owner_id Uint64, household_id String, + PRIMARY KEY (guest_huid, owner_huid, household_id), + INDEX shared_households_owner_huid GLOBAL SYNC ON (`owner_huid`) + );)"); + auto result = session.ExecuteSchemeQuery(createTableSql).GetValueSync(); + UNIT_ASSERT_C(result.IsSuccess(), result.GetIssues().ToString()); + } + + { + const TString query(Q1_(R"( + SELECT + guest_id + FROM + SharedHouseholds VIEW shared_households_owner_huid + WHERE + owner_huid == 1 AND + household_id == "1"; + )")); + + auto result = client.ExecuteYqlScript(query).GetValueSync(); + + UNIT_ASSERT_C(result.GetIssues().Empty(), result.GetIssues().ToString()); + UNIT_ASSERT(result.IsSuccess()); + UNIT_ASSERT_VALUES_EQUAL(NYdb::FormatResultSetYson(result.GetResultSet(0)), "[]"); + } + } + Y_UNIT_TEST_QUAD(SecondaryIndexSelect, WithMvcc, UseNewEngine) { auto setting = NKikimrKqp::TKqpSetting(); auto serverSettings = TKikimrSettings() |