diff options
author | spuchin <spuchin@ydb.tech> | 2023-06-23 18:04:41 +0300 |
---|---|---|
committer | spuchin <spuchin@ydb.tech> | 2023-06-23 18:04:41 +0300 |
commit | 5574d451ac2319e620a5f49c4ca3ef3e0944dc56 (patch) | |
tree | e8ad36b09522e351d70a7dee2b777b7f726d73f4 | |
parent | af207c571a5855b41675286f62e08a465e379041 (diff) | |
download | ydb-5574d451ac2319e620a5f49c4ca3ef3e0944dc56.tar.gz |
Allow writes in generic query. ()
-rw-r--r-- | ydb/core/kqp/host/kqp_runner.cpp | 9 | ||||
-rw-r--r-- | ydb/core/kqp/ut/service/kqp_query_service_ut.cpp | 14 |
2 files changed, 14 insertions, 9 deletions
diff --git a/ydb/core/kqp/host/kqp_runner.cpp b/ydb/core/kqp/host/kqp_runner.cpp index 5f3cfbca78..d9f7c0fe34 100644 --- a/ydb/core/kqp/host/kqp_runner.cpp +++ b/ydb/core/kqp/host/kqp_runner.cpp @@ -185,15 +185,6 @@ public: YQL_ENSURE(TMaybeNode<TKiDataQueryBlocks>(query)); TKiDataQueryBlocks dataQueryBlocks(query); - YQL_ENSURE(dataQueryBlocks.ArgCount() == 1); - - const auto& queryBlock = dataQueryBlocks.Arg(0); - if (queryBlock.Effects().ArgCount() > 0) { - ctx.AddError(YqlIssue(ctx.GetPosition(dataQueryBlocks.Pos()), TIssuesIds::KIKIMR_PRECONDITION_FAILED, - "Data modifications not yet supported.")); - return MakeKikimrResultHolder(ResultFromErrors<IKqpHost::TQueryResult>(ctx.IssueManager.GetIssues())); - } - return PrepareQueryInternal(cluster, dataQueryBlocks, ctx, settings); } diff --git a/ydb/core/kqp/ut/service/kqp_query_service_ut.cpp b/ydb/core/kqp/ut/service/kqp_query_service_ut.cpp index ee2d91884b..13daa1c6de 100644 --- a/ydb/core/kqp/ut/service/kqp_query_service_ut.cpp +++ b/ydb/core/kqp/ut/service/kqp_query_service_ut.cpp @@ -167,6 +167,20 @@ Y_UNIT_TEST_SUITE(KqpQueryService) { CompareYson(R"([[6u]])", FormatResultSetYson(result.GetResultSet(1))); } + Y_UNIT_TEST(ExecuteQueryWrite) { + auto kikimr = DefaultKikimrRunner(); + auto db = kikimr.GetQueryClient(); + + auto result = db.ExecuteQuery(R"( + UPSERT INTO TwoShard (Key, Value2) VALUES(0, 101); + + SELECT Value2 FROM TwoShard WHERE Key = 0; + )", TTxControl::BeginTx().CommitTx()).ExtractValueSync(); + UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); + + CompareYson(R"([[[101]]])", FormatResultSetYson(result.GetResultSet(0))); + } + Y_UNIT_TEST(ExplainQuery) { auto kikimr = DefaultKikimrRunner(); auto db = kikimr.GetQueryClient(); |