diff options
author | va-kuznecov <[email protected]> | 2023-11-30 18:25:21 +0300 |
---|---|---|
committer | va-kuznecov <[email protected]> | 2023-11-30 20:56:21 +0300 |
commit | 2e9a8eef3f1c43ef58d2f99e5266f575df48b6c8 (patch) | |
tree | 6465569b0bb2017cb3e7598588faaa99d9bd3241 | |
parent | 6239a1866450870ffdb2e6dd30bb17de5b34ea62 (diff) |
fix empty issue in ReadRows KIKIMR-20296
-rw-r--r-- | ydb/core/grpc_services/CMakeLists.darwin-arm64.txt | 1 | ||||
-rw-r--r-- | ydb/core/grpc_services/CMakeLists.darwin-x86_64.txt | 1 | ||||
-rw-r--r-- | ydb/core/grpc_services/CMakeLists.linux-aarch64.txt | 1 | ||||
-rw-r--r-- | ydb/core/grpc_services/CMakeLists.linux-x86_64.txt | 1 | ||||
-rw-r--r-- | ydb/core/grpc_services/CMakeLists.windows-x86_64.txt | 1 | ||||
-rw-r--r-- | ydb/core/grpc_services/rpc_read_rows.cpp | 9 | ||||
-rw-r--r-- | ydb/core/grpc_services/ya.make | 1 | ||||
-rw-r--r-- | ydb/core/kqp/ut/opt/kqp_kv_ut.cpp | 30 |
8 files changed, 41 insertions, 4 deletions
diff --git a/ydb/core/grpc_services/CMakeLists.darwin-arm64.txt b/ydb/core/grpc_services/CMakeLists.darwin-arm64.txt index 30f46225c46..42e3c2e08c4 100644 --- a/ydb/core/grpc_services/CMakeLists.darwin-arm64.txt +++ b/ydb/core/grpc_services/CMakeLists.darwin-arm64.txt @@ -59,6 +59,7 @@ target_link_libraries(ydb-core-grpc_services PUBLIC library-persqueue-topic_parser parser-pg_wrapper-interface yql-public-types + yql-public-issue ydb-library-services api-grpc-draft api-protos diff --git a/ydb/core/grpc_services/CMakeLists.darwin-x86_64.txt b/ydb/core/grpc_services/CMakeLists.darwin-x86_64.txt index 30f46225c46..42e3c2e08c4 100644 --- a/ydb/core/grpc_services/CMakeLists.darwin-x86_64.txt +++ b/ydb/core/grpc_services/CMakeLists.darwin-x86_64.txt @@ -59,6 +59,7 @@ target_link_libraries(ydb-core-grpc_services PUBLIC library-persqueue-topic_parser parser-pg_wrapper-interface yql-public-types + yql-public-issue ydb-library-services api-grpc-draft api-protos diff --git a/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt b/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt index dbeec96adfd..eabc5819db4 100644 --- a/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt +++ b/ydb/core/grpc_services/CMakeLists.linux-aarch64.txt @@ -60,6 +60,7 @@ target_link_libraries(ydb-core-grpc_services PUBLIC library-persqueue-topic_parser parser-pg_wrapper-interface yql-public-types + yql-public-issue ydb-library-services api-grpc-draft api-protos diff --git a/ydb/core/grpc_services/CMakeLists.linux-x86_64.txt b/ydb/core/grpc_services/CMakeLists.linux-x86_64.txt index dbeec96adfd..eabc5819db4 100644 --- a/ydb/core/grpc_services/CMakeLists.linux-x86_64.txt +++ b/ydb/core/grpc_services/CMakeLists.linux-x86_64.txt @@ -60,6 +60,7 @@ target_link_libraries(ydb-core-grpc_services PUBLIC library-persqueue-topic_parser parser-pg_wrapper-interface yql-public-types + yql-public-issue ydb-library-services api-grpc-draft api-protos diff --git a/ydb/core/grpc_services/CMakeLists.windows-x86_64.txt b/ydb/core/grpc_services/CMakeLists.windows-x86_64.txt index 30f46225c46..42e3c2e08c4 100644 --- a/ydb/core/grpc_services/CMakeLists.windows-x86_64.txt +++ b/ydb/core/grpc_services/CMakeLists.windows-x86_64.txt @@ -59,6 +59,7 @@ target_link_libraries(ydb-core-grpc_services PUBLIC library-persqueue-topic_parser parser-pg_wrapper-interface yql-public-types + yql-public-issue ydb-library-services api-grpc-draft api-protos diff --git a/ydb/core/grpc_services/rpc_read_rows.cpp b/ydb/core/grpc_services/rpc_read_rows.cpp index 11e172ad9b3..1331639cbcf 100644 --- a/ydb/core/grpc_services/rpc_read_rows.cpp +++ b/ydb/core/grpc_services/rpc_read_rows.cpp @@ -591,6 +591,11 @@ public: void SendResult(const Ydb::StatusIds::StatusCode& status, const TString& errorMsg) { auto* resp = CreateResponse(); resp->set_status(status); + if (!errorMsg.Empty()) { + const NYql::TIssue& issue = MakeIssue(NKikimrIssues::TIssuesIds::DEFAULT_ERROR, errorMsg); + auto* protoIssue = resp->add_issues(); + NYql::IssueToMessage(issue, protoIssue); + } if (status == Ydb::StatusIds::SUCCESS) { Request->SetRuHeader(RuCost); @@ -598,10 +603,6 @@ public: FillResultRows(resp); } - if (errorMsg) { - Request->RaiseIssue(NYql::TIssue(errorMsg)); - } - LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::RPC_REQUEST, "TReadRowsRPC sent result"); Request->Reply(resp, status); PassAway(); diff --git a/ydb/core/grpc_services/ya.make b/ydb/core/grpc_services/ya.make index fe47e03513c..aff471b356b 100644 --- a/ydb/core/grpc_services/ya.make +++ b/ydb/core/grpc_services/ya.make @@ -124,6 +124,7 @@ PEERDIR( ydb/library/persqueue/topic_parser ydb/library/yql/parser/pg_wrapper/interface ydb/library/yql/public/types + ydb/library/yql/public/issue ydb/library/services ydb/public/api/grpc/draft ydb/public/api/protos diff --git a/ydb/core/kqp/ut/opt/kqp_kv_ut.cpp b/ydb/core/kqp/ut/opt/kqp_kv_ut.cpp index 4f39ba072f5..0597df0d72e 100644 --- a/ydb/core/kqp/ut/opt/kqp_kv_ut.cpp +++ b/ydb/core/kqp/ut/opt/kqp_kv_ut.cpp @@ -189,6 +189,7 @@ Y_UNIT_TEST_SUITE(KqpKv) { keys.EndList(); auto selectResult = db.ReadRows("/Root/WrongTable", keys.Build()).GetValueSync(); UNIT_ASSERT_C(!selectResult.IsSuccess(), selectResult.GetIssues().ToString()); + UNIT_ASSERT_C(selectResult.GetIssues().ToString().Size(), "Expect non-empty issue in case of error"); UNIT_ASSERT_EQUAL(selectResult.GetStatus(), EStatus::SCHEME_ERROR); auto res = FormatResultSetYson(selectResult.GetResultSet()); CompareYson("[]", res); @@ -279,6 +280,35 @@ Y_UNIT_TEST_SUITE(KqpKv) { } } + Y_UNIT_TEST(ReadRows_NotFullPK) { + auto settings = TKikimrSettings() + .SetWithSampleTables(false); + auto kikimr = TKikimrRunner{settings}; + auto db = kikimr.GetTableClient(); + auto session = db.CreateSession().GetValueSync().GetSession(); + + auto schemeResult = session.ExecuteSchemeQuery(R"( + CREATE TABLE TestTable ( + Key Uint64, + Data Uint32, + Value Utf8, + PRIMARY KEY (Key) + ); + )").GetValueSync(); + UNIT_ASSERT_C(schemeResult.IsSuccess(), schemeResult.GetIssues().ToString()); + + NYdb::TValueBuilder keys; + keys.BeginList() + .AddListItem() + .BeginStruct() + .EndStruct() + .EndList(); + + auto selectResult = db.ReadRows("/Root/TestTable", keys.Build()).GetValueSync(); + UNIT_ASSERT_C(!selectResult.IsSuccess(), selectResult.GetIssues().ToString()); + UNIT_ASSERT_C(selectResult.GetIssues().ToString().Size(), "Expect non-empty issues in case of error"); + } + Y_UNIT_TEST(ReadRows_SpecificReturnValue) { auto settings = TKikimrSettings() .SetWithSampleTables(false); |