diff options
author | qrort <qrort@yandex-team.com> | 2023-06-02 14:59:40 +0300 |
---|---|---|
committer | qrort <qrort@yandex-team.com> | 2023-06-02 14:59:40 +0300 |
commit | 3acafc60c5a4ad31542e5f0f8b3d35f5ec292614 (patch) | |
tree | 079ae46934563887a5b1cc5281eceff3fa586ea4 | |
parent | 2db4f2f2bb216d58c151f26bba0a849c79beadc5 (diff) | |
download | ydb-3acafc60c5a4ad31542e5f0f8b3d35f5ec292614.tar.gz |
query type to GENERIC
5 files changed, 18 insertions, 46 deletions
diff --git a/ydb/core/local_pgwire/CMakeLists.darwin-x86_64.txt b/ydb/core/local_pgwire/CMakeLists.darwin-x86_64.txt index a602e5c6b5..3a5619b0c2 100644 --- a/ydb/core/local_pgwire/CMakeLists.darwin-x86_64.txt +++ b/ydb/core/local_pgwire/CMakeLists.darwin-x86_64.txt @@ -16,7 +16,8 @@ target_link_libraries(ydb-core-local_pgwire PUBLIC yutil cpp-actors-core yql-public-udf - core-kqp-common + kqp-common-events + kqp-common-simple core-kqp-executer_actor ydb-core-grpc_services core-grpc_services-local_rpc diff --git a/ydb/core/local_pgwire/CMakeLists.linux-aarch64.txt b/ydb/core/local_pgwire/CMakeLists.linux-aarch64.txt index f1413b31aa..eff4654e45 100644 --- a/ydb/core/local_pgwire/CMakeLists.linux-aarch64.txt +++ b/ydb/core/local_pgwire/CMakeLists.linux-aarch64.txt @@ -17,7 +17,8 @@ target_link_libraries(ydb-core-local_pgwire PUBLIC yutil cpp-actors-core yql-public-udf - core-kqp-common + kqp-common-events + kqp-common-simple core-kqp-executer_actor ydb-core-grpc_services core-grpc_services-local_rpc diff --git a/ydb/core/local_pgwire/CMakeLists.linux-x86_64.txt b/ydb/core/local_pgwire/CMakeLists.linux-x86_64.txt index f1413b31aa..eff4654e45 100644 --- a/ydb/core/local_pgwire/CMakeLists.linux-x86_64.txt +++ b/ydb/core/local_pgwire/CMakeLists.linux-x86_64.txt @@ -17,7 +17,8 @@ target_link_libraries(ydb-core-local_pgwire PUBLIC yutil cpp-actors-core yql-public-udf - core-kqp-common + kqp-common-events + kqp-common-simple core-kqp-executer_actor ydb-core-grpc_services core-grpc_services-local_rpc diff --git a/ydb/core/local_pgwire/CMakeLists.windows-x86_64.txt b/ydb/core/local_pgwire/CMakeLists.windows-x86_64.txt index a602e5c6b5..3a5619b0c2 100644 --- a/ydb/core/local_pgwire/CMakeLists.windows-x86_64.txt +++ b/ydb/core/local_pgwire/CMakeLists.windows-x86_64.txt @@ -16,7 +16,8 @@ target_link_libraries(ydb-core-local_pgwire PUBLIC yutil cpp-actors-core yql-public-udf - core-kqp-common + kqp-common-events + kqp-common-simple core-kqp-executer_actor ydb-core-grpc_services core-grpc_services-local_rpc diff --git a/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp b/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp index 35808996a2..ca464e9ab2 100644 --- a/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp +++ b/ydb/core/local_pgwire/pgwire_kqp_proxy.cpp @@ -1,6 +1,5 @@ #include "log_impl.h" #include "local_pgwire_util.h" -#include <ydb/core/kqp/common/kqp.h> #include <ydb/core/kqp/common/events/events.h> #include <ydb/core/kqp/common/simple/services.h> #include <ydb/core/kqp/executer_actor/kqp_executer.h> @@ -82,20 +81,9 @@ public: try { if (record.HasYdbStatus()) { if (record.GetYdbStatus() == Ydb::StatusIds::SUCCESS) { - auto noScript = ConnectionParams_.find("no-script") != ConnectionParams_.end(); - if (noScript) { - Y_ENSURE(record.GetResponse().GetYdbResults().empty()); - if (!ResultSets_.empty()) { - FillResultSet(ResultSets_.begin()->second, response.get()); - } - } else { - Y_ENSURE(ResultSets_.empty()); - auto results = record.GetResponse().GetResults(); - if (!results.empty()) { - auto ydbResult = record.MutableResponse()->MutableYdbResults()->Add(); - NKqp::ConvertKqpQueryResultToDbResult(results.at(0), ydbResult); - FillResultSet(*ydbResult, response.get()); - } + Y_ENSURE(record.GetResponse().GetYdbResults().empty()); + if (!ResultSets_.empty()) { + FillResultSet(ResultSets_.begin()->second, response.get()); } // HACK @@ -139,14 +127,9 @@ public: NKikimrKqp::TQueryRequest& request = *event->Record.MutableRequest(); request.SetQuery(ToPgSyntax(query, ConnectionParams_)); request.SetAction(NKikimrKqp::QUERY_ACTION_EXECUTE); - auto noScript = ConnectionParams_.find("no-script"); - if (noScript == ConnectionParams_.end()) { - request.SetType(NKikimrKqp::QUERY_TYPE_SQL_SCRIPT); - } else { - request.SetType(NKikimrKqp::QUERY_TYPE_SQL_GENERIC_QUERY); - request.MutableTxControl()->mutable_begin_tx()->mutable_serializable_read_write(); - request.MutableTxControl()->set_commit_tx(true); - } + request.SetType(NKikimrKqp::QUERY_TYPE_SQL_GENERIC_QUERY); + request.MutableTxControl()->mutable_begin_tx()->mutable_serializable_read_write(); + request.MutableTxControl()->set_commit_tx(true); request.SetKeepSession(false); request.SetDatabase(database); event->Record.SetUserToken(token); @@ -193,14 +176,9 @@ public: NKikimrKqp::TQueryRequest& request = *event->Record.MutableRequest(); request.SetQuery(ToPgSyntax(query, ConnectionParams_)); request.SetAction(NKikimrKqp::QUERY_ACTION_EXECUTE); - auto noScript = ConnectionParams_.find("no-script"); - if (noScript == ConnectionParams_.end()) { - request.SetType(NKikimrKqp::QUERY_TYPE_SQL_SCRIPT); - } else { - request.SetType(NKikimrKqp::QUERY_TYPE_SQL_GENERIC_QUERY); - request.MutableTxControl()->mutable_begin_tx()->mutable_serializable_read_write(); - request.MutableTxControl()->set_commit_tx(true); - } + request.SetType(NKikimrKqp::QUERY_TYPE_SQL_GENERIC_QUERY); + request.MutableTxControl()->mutable_begin_tx()->mutable_serializable_read_write(); + request.MutableTxControl()->set_commit_tx(true); request.SetKeepSession(false); request.SetDatabase(database); event->Record.SetUserToken(token); @@ -284,22 +262,12 @@ public: try { if (record.HasYdbStatus()) { if (record.GetYdbStatus() == Ydb::StatusIds::SUCCESS) { - auto results = record.GetResponse().GetResults(); - if (!results.empty()) { - auto resultSet = record.MutableResponse()->MutableYdbResults()->Add(); - NKqp::ConvertKqpQueryResultToDbResult(results.at(0), resultSet); - if (!WasMeta_) { - FillMeta(*resultSet, response.get()); - WasMeta_ = true; - } - FillResultSet(*resultSet, response.get()); - } + Y_ENSURE(record.GetResponse().GetResults().empty()); // HACK if (response->DataRows.size() > 0) { response->Tag = TStringBuilder() << "SELECT " << response->DataRows.size(); } - } else { NYql::TIssues issues; NYql::IssuesFromMessage(record.GetResponse().GetQueryIssues(), issues); |