Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
VPolka committed May 28, 2024
1 parent 0b49188 commit f3de9bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions ydb/core/kqp/session_actor/kqp_query_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ std::unique_ptr<TEvKqp::TEvCompileRequest> TKqpQueryState::BuildCompileSplittedR
false, SplittedCtx.Get(), SplittedExprs.at(NextSplittedExpr));
}

bool TKqpQueryState::ProcessingLastStatementPart() {
return SplittedExprs.empty() || (NextSplittedExpr + 1 >= static_cast<int>(SplittedExprs.size()));
}

bool TKqpQueryState::PrepareNextStatementPart() {
QueryData = {};
PreparedQuery = {};
Expand All @@ -335,16 +339,15 @@ bool TKqpQueryState::PrepareNextStatementPart() {
TopicOperations = {};
ReplayMessage = {};

++NextSplittedExpr;

if (NextSplittedExpr >= static_cast<int>(SplittedExprs.size()) || SplittedExprs.empty()) {
if (ProcessingLastStatementPart()) {
SplittedWorld.Reset();
SplittedExprs.clear();
SplittedCtx.Reset();
NextSplittedExpr = -1;
return false;
}

++NextSplittedExpr;
return true;
}

Expand Down
1 change: 1 addition & 0 deletions ydb/core/kqp/session_actor/kqp_query_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ class TKqpQueryState : public TNonCopyable {
std::unique_ptr<TEvKqp::TEvCompileRequest> BuildSplitRequest(std::shared_ptr<std::atomic<bool>> cookie, const TGUCSettings::TPtr& gUCSettingsPtr);
std::unique_ptr<TEvKqp::TEvCompileRequest> BuildCompileSplittedRequest(std::shared_ptr<std::atomic<bool>> cookie, const TGUCSettings::TPtr& gUCSettingsPtr);

bool ProcessingLastStatementPart();
bool PrepareNextStatementPart();

const ::google::protobuf::Map<TProtoStringType, ::Ydb::TypedValue>& GetYdbParameters() const {
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/kqp/session_actor/kqp_session_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ class TKqpSessionActor : public TActorBootstrapped<TKqpSessionActor> {
QueryState->ImplicitTxId = QueryState->TxId;
}
Ydb::Table::TransactionControl control;
control.set_commit_tx(QueryState->ProcessingLastStatement());
control.set_commit_tx(QueryState->ProcessingLastStatement() && QueryState->ProcessingLastStatementPart());
control.set_tx_id(QueryState->ImplicitTxId->GetValue().GetHumanStr());
return control;
}
Expand Down

0 comments on commit f3de9bd

Please sign in to comment.