Skip to content

Commit

Permalink
Merge 885c359 into 4d2fffa
Browse files Browse the repository at this point in the history
  • Loading branch information
gridnevvvit authored Sep 30, 2024
2 parents 4d2fffa + 885c359 commit 9af720c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
8 changes: 4 additions & 4 deletions ydb/core/kqp/compile_service/kqp_compile_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,9 @@ class TKqpCompileActor : public TActorBootstrapped<TKqpCompileActor> {
}

void FillCompileResult(std::unique_ptr<NKikimrKqp::TPreparedQuery> preparingQuery, NKikimrKqp::EQueryType queryType,
bool allowCache) {
bool allowCache, bool success) {
auto preparedQueryHolder = std::make_shared<TPreparedQueryHolder>(
preparingQuery.release(), AppData()->FunctionRegistry);
preparingQuery.release(), AppData()->FunctionRegistry, !success);
preparedQueryHolder->MutableLlvmSettings().Fill(Config, queryType);
KqpCompileResult->PreparedQuery = preparedQueryHolder;
KqpCompileResult->AllowCache = CanCacheQuery(KqpCompileResult->PreparedQuery->GetPhysicalQuery()) && allowCache;
Expand Down Expand Up @@ -501,7 +501,7 @@ class TKqpCompileActor : public TActorBootstrapped<TKqpCompileActor> {

if (status == Ydb::StatusIds::SUCCESS) {
YQL_ENSURE(kqpResult.PreparingQuery);
FillCompileResult(std::move(kqpResult.PreparingQuery), queryType, kqpResult.AllowCache);
FillCompileResult(std::move(kqpResult.PreparingQuery), queryType, kqpResult.AllowCache, true);

auto now = TInstant::Now();
auto duration = now - StartTime;
Expand All @@ -512,7 +512,7 @@ class TKqpCompileActor : public TActorBootstrapped<TKqpCompileActor> {
<< ", duration: " << duration);
} else {
if (kqpResult.PreparingQuery) {
FillCompileResult(std::move(kqpResult.PreparingQuery), queryType, kqpResult.AllowCache);
FillCompileResult(std::move(kqpResult.PreparingQuery), queryType, kqpResult.AllowCache, false);
}

LOG_ERROR_S(ctx, NKikimrServices::KQP_COMPILE_ACTOR, "Compilation failed"
Expand Down
7 changes: 6 additions & 1 deletion ydb/core/kqp/query_data/kqp_prepared_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const NKikimr::NKqp::TStagePredictor& TKqpPhyTxHolder::GetCalculationPredictor(c
}

TPreparedQueryHolder::TPreparedQueryHolder(NKikimrKqp::TPreparedQuery* proto,
const NKikimr::NMiniKQL::IFunctionRegistry* functionRegistry)
const NKikimr::NMiniKQL::IFunctionRegistry* functionRegistry, bool noFillTables)
: Proto(proto)
, Alloc(nullptr)
, TableConstInfoById(MakeIntrusive<TTableConstInfoMap>())
Expand All @@ -164,6 +164,11 @@ TPreparedQueryHolder::TPreparedQueryHolder(NKikimrKqp::TPreparedQuery* proto,
Alloc = std::make_shared<TPreparedQueryAllocHolder>(functionRegistry);
}

// In case of some compilation failures filling tables may produce new problems which may replace original error messages.
if (noFillTables) {
return;
}

THashSet<TString> tablesSet;
const auto& phyQuery = Proto->GetPhysicalQuery();
Transactions.reserve(phyQuery.TransactionsSize());
Expand Down
5 changes: 4 additions & 1 deletion ydb/core/kqp/query_data/kqp_prepared_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ class TPreparedQueryHolder {

public:

TPreparedQueryHolder(NKikimrKqp::TPreparedQuery* proto, const NKikimr::NMiniKQL::IFunctionRegistry* functionRegistry);
TPreparedQueryHolder(
NKikimrKqp::TPreparedQuery* proto,
const NKikimr::NMiniKQL::IFunctionRegistry* functionRegistry,
bool noFillTables = false);
~TPreparedQueryHolder();

using TConstPtr = std::shared_ptr<const TPreparedQueryHolder>;
Expand Down

0 comments on commit 9af720c

Please sign in to comment.