Skip to content

Commit 3d06832

Browse files
authored
filter pg const params in response (#5711)
1 parent e58b6f6 commit 3d06832

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

ydb/core/kqp/session_actor/kqp_query_state.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ bool TKqpQueryState::SaveAndCheckCompileResult(TEvKqp::TEvCompileResponse* ev) {
159159
if (!CommandTagName) {
160160
CommandTagName = CompileResult->CommandTagName;
161161
}
162+
for (const auto& param : PreparedQuery->GetParameters()) {
163+
const auto& ast = CompileResult->Ast;
164+
if (!ast || !ast->PgAutoParamValues || !ast->PgAutoParamValues->contains(param.GetName())) {
165+
ResultParams.push_back(param);
166+
}
167+
}
162168
return true;
163169
}
164170

ydb/core/kqp/session_actor/kqp_query_state.h

+5
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ class TKqpQueryState : public TNonCopyable {
103103
ui64 ParametersSize = 0;
104104
TPreparedQueryHolder::TConstPtr PreparedQuery;
105105
TKqpCompileResult::TConstPtr CompileResult;
106+
TVector<NKikimrKqp::TParameterDescription> ResultParams;
106107
TKqpStatsCompile CompileStats;
107108
TIntrusivePtr<TKqpTransactionContext> TxCtx;
108109
TQueryData::TPtr QueryData;
@@ -188,6 +189,10 @@ class TKqpQueryState : public TNonCopyable {
188189
return QueryParameterTypes;
189190
}
190191

192+
TVector<NKikimrKqp::TParameterDescription> GetResultParams() const {
193+
return ResultParams;
194+
}
195+
191196
void EnsureAction() {
192197
YQL_ENSURE(RequestEv->HasAction());
193198
}

ydb/core/kqp/session_actor/kqp_session_actor.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -1697,8 +1697,9 @@ class TKqpSessionActor : public TActorBootstrapped<TKqpSessionActor> {
16971697

16981698
if (replyQueryParameters) {
16991699
YQL_ENSURE(QueryState->PreparedQuery);
1700-
response->MutableQueryParameters()->CopyFrom(
1701-
QueryState->PreparedQuery->GetParameters());
1700+
for (auto& param : QueryState->GetResultParams()) {
1701+
*response->AddQueryParameters() = param;
1702+
}
17021703
}
17031704

17041705
if (replyQueryId) {
@@ -1902,7 +1903,9 @@ class TKqpSessionActor : public TActorBootstrapped<TKqpSessionActor> {
19021903
response.SetPreparedQuery(compileResult->Uid);
19031904

19041905
auto& preparedQuery = compileResult->PreparedQuery;
1905-
response.MutableQueryParameters()->CopyFrom(preparedQuery->GetParameters());
1906+
for (auto& param : QueryState->GetResultParams()) {
1907+
*response.AddQueryParameters() = param;
1908+
}
19061909

19071910
response.SetQueryPlan(preparedQuery->GetPhysicalQuery().GetQueryPlan());
19081911
response.SetQueryAst(preparedQuery->GetPhysicalQuery().GetQueryAst());

0 commit comments

Comments
 (0)