diff --git a/ydb/core/grpc_services/CMakeLists.darwin-arm64.txt b/ydb/core/grpc_services/CMakeLists.darwin-arm64.txt index 30f46225c465..42e3c2e08c4f 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 30f46225c465..42e3c2e08c4f 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 dbeec96adfdb..eabc5819db48 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 dbeec96adfdb..eabc5819db48 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 30f46225c465..42e3c2e08c4f 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 11e172ad9b3a..1331639cbcf7 100644 --- a/ydb/core/grpc_services/rpc_read_rows.cpp +++ b/ydb/core/grpc_services/rpc_read_rows.cpp @@ -591,6 +591,11 @@ class TReadRowsRPC : public TActorBootstrapped { 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 @@ class TReadRowsRPC : public TActorBootstrapped { 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 fe47e03513cc..aff471b356bc 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 4f39ba072f5d..0597df0d72e9 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);