diff options
author | ssmike <ssmike@ydb.tech> | 2023-08-28 21:54:57 +0300 |
---|---|---|
committer | ssmike <ssmike@ydb.tech> | 2023-08-28 22:23:13 +0300 |
commit | e2a75403713aee4d931e95115bbd9ab750c90068 (patch) | |
tree | 611e482399173f302d683c53dba1221e38bb4754 | |
parent | 303d70e7a58d546e1f774d24325f16db8972c4b4 (diff) | |
download | ydb-e2a75403713aee4d931e95115bbd9ab750c90068.tar.gz |
Skipnull test
-rw-r--r-- | ydb/core/kqp/ut/opt/kqp_ne_ut.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/ydb/core/kqp/ut/opt/kqp_ne_ut.cpp b/ydb/core/kqp/ut/opt/kqp_ne_ut.cpp index 78e566fa533..9c2d0897cce 100644 --- a/ydb/core/kqp/ut/opt/kqp_ne_ut.cpp +++ b/ydb/core/kqp/ut/opt/kqp_ne_ut.cpp @@ -3805,6 +3805,73 @@ Y_UNIT_TEST_SUITE(KqpNewEngine) { CompareYson(R"([[[1u];["NewValue2"]]])", FormatResultSetYson(result.GetResultSet(0))); } + + Y_UNIT_TEST(OddSkipNullKeys) { + TKikimrSettings settings; + NKikimrConfig::TAppConfig appConfig; + appConfig.MutableTableServiceConfig()->SetPredicateExtract20(false); + settings.SetAppConfig(appConfig); + + TKikimrRunner kikimr(settings); + auto db = kikimr.GetTableClient(); + + { + auto session = db.CreateSession().GetValueSync().GetSession(); + AssertSuccessResult(session.ExecuteSchemeQuery(R"( + --!syntax_v1 + + CREATE TABLE `/Root/tickets` ( + entity_id Utf8, + updated_at_desc Uint64, + state Utf8, + access_type Utf8, + entity_type Utf8, + id Utf8, + iam_user_id Utf8, + PRIMARY KEY (id, entity_type, access_type, state, updated_at_desc, entity_id, iam_user_id) + ); + + )").GetValueSync()); + + AssertSuccessResult(session.ExecuteDataQuery(R"( + REPLACE INTO `/Root/tickets` (entity_id, updated_at_desc, state, access_type, entity_type, id, iam_user_id) VALUES + (null, 0, "state", "access", "type", "id", "iam_id"); + )", TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).GetValueSync()); + + } + + auto params = + TParamsBuilder() + .AddParam("$id_6").OptionalUtf8("id").Build() + .AddParam("$iam_user_id_3").OptionalUtf8("iam_id").Build() + .AddParam("$state_3").OptionalUtf8("state").Build() + .AddParam("$updated_at_desc_2").OptionalUint64(0).Build() + .AddParam("$access_type_2").OptionalUtf8("access").Build() + .AddParam("$entity_type_0").OptionalUtf8("type").Build() + .Build(); + + auto session = db.CreateSession().GetValueSync().GetSession(); + auto result = session.ExecuteDataQuery(R"( + --!syntax_v1 + DECLARE $access_type_2 AS Optional<Utf8>; + DECLARE $entity_type_0 AS Optional<Utf8>; + DECLARE $iam_user_id_3 AS Optional<Utf8>; + DECLARE $id_6 AS Optional<Utf8>; + DECLARE $state_3 AS Optional<Utf8>; + DECLARE $updated_at_desc_2 AS Optional<Uint64>; + + SELECT id FROM `/Root/tickets` + WHERE access_type = $access_type_2 + AND entity_id IS NULL + AND entity_type = $entity_type_0 + AND iam_user_id = $iam_user_id_3 + AND id = $id_6 + AND state = $state_3 + AND updated_at_desc = $updated_at_desc_2; + )", TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx(), params).GetValueSync(); + + CompareYson(R"([[["id"]]])", FormatResultSetYson(result.GetResultSet(0))); + } } } // namespace NKikimr::NKqp |