diff options
author | ivanmorozov333 <111685085+ivanmorozov333@users.noreply.github.com> | 2024-03-05 17:26:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-05 17:26:37 +0300 |
commit | 0902f9bf8bb8c0178d7cceadbfefb5e753f1d45e (patch) | |
tree | 05059eceb5c57630dfe53c19f8b8dae58a067a9f | |
parent | ae4590afe2997e7154a290eb72f2d365cce0fafb (diff) | |
download | ydb-0902f9bf8bb8c0178d7cceadbfefb5e753f1d45e.tar.gz |
add test for correct jsonpath usage usage checker (#2462)
-rw-r--r-- | ydb/core/kqp/ut/olap/kqp_olap_ut.cpp | 18 | ||||
-rw-r--r-- | ydb/core/testlib/cs_helper.cpp | 4 |
2 files changed, 19 insertions, 3 deletions
diff --git a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp index c04a8ea37b..8f9a3f8fa7 100644 --- a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp +++ b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp @@ -5477,7 +5477,23 @@ Y_UNIT_TEST_SUITE(KqpOlap) { #endif .SetExpectedReply(R"([[1;["val1"];#]])"); - TestTableWithNulls({ testCase }); + TestTableWithNulls({testCase}); + } + + Y_UNIT_TEST(Json_GetValue_Minus) { + TAggregationTestCase testCase; + testCase.SetQuery(R"( + SELECT id, JSON_VALUE(jsonval, "$.'col-abc'"), JSON_VALUE(jsondoc, "$.'col-abc'") FROM `/Root/tableWithNulls` + WHERE JSON_VALUE(jsonval, "$.'col-abc'") = "val-abc" AND id = 1; + )") +#if SSA_RUNTIME_VERSION >= 3U + .AddExpectedPlanOptions("KqpOlapJsonValue") +#else + .AddExpectedPlanOptions("Udf") +#endif + .SetExpectedReply(R"([[1;["val-abc"];#]])"); + + TestTableWithNulls({testCase}); } Y_UNIT_TEST(Json_GetValue_ToString) { diff --git a/ydb/core/testlib/cs_helper.cpp b/ydb/core/testlib/cs_helper.cpp index f1aff52dbf..4a4e789af1 100644 --- a/ydb/core/testlib/cs_helper.cpp +++ b/ydb/core/testlib/cs_helper.cpp @@ -426,11 +426,11 @@ std::shared_ptr<arrow::RecordBatch> TTableWithNullsHelper::TestArrowBatch(ui64, Y_ABORT_UNLESS(bResourceId.AppendNull().ok()); Y_ABORT_UNLESS(bLevel.Append(i).ok()); Y_ABORT_UNLESS(bBinaryStr.AppendNull().ok()); - Y_ABORT_UNLESS(bJsonVal.Append(std::string(R"({"col1": "val1", "obj": {"obj_col2_int": 16}})")).ok()); + Y_ABORT_UNLESS(bJsonVal.Append(std::string(R"({"col1": "val1", "col-abc": "val-abc", "obj": {"obj_col2_int": 16}})")).ok()); Y_ABORT_UNLESS(bJsonDoc.AppendNull().ok()); } - const auto maybeJsonDoc = std::string(R"({"col1": "val1", "obj": {"obj_col2_int": 16}})"); + const auto maybeJsonDoc = std::string(R"({"col1": "val1", "col-abc": "val-abc", "obj": {"obj_col2_int": 16}})"); for (size_t i = rowCount / 2 + 1; i <= rowCount; ++i) { Y_ABORT_UNLESS(bId.Append(i).ok()); Y_ABORT_UNLESS(bResourceId.Append(std::to_string(i)).ok()); |