Skip to content

Commit ae3f2a4

Browse files
committed
Write to replay log before ensuring the query is prepared + minor style fixes
1 parent 23edc19 commit ae3f2a4

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

ydb/core/kqp/compile_service/kqp_compile_actor.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,15 +413,14 @@ class TKqpCompileActor : public TActorBootstrapped<TKqpCompileActor> {
413413
KqpCompileResult = TKqpCompileResult::Make(Uid, status, kqpResult.Issues(), maxReadType, std::move(QueryId));
414414

415415
if (status == Ydb::StatusIds::SUCCESS) {
416-
YQL_ENSURE(kqpResult.PreparingQuery);
417-
418416
auto collectedSchemeData = Gateway->GetCollectedSchemeData();
419417
AddMessageToReplayLog(kqpResult.QueryPlan, collectedSchemeData);
420418
EraseIf(collectedSchemeData, [](const NKikimrKqp::TKqpTableMetadataProto& metadata) {
421419
return !metadata.HasKind() || static_cast<EKikimrTableKind>(metadata.GetKind()) != EKikimrTableKind::View;
422420
});
423421

424-
FillCompileResult(std::move(kqpResult.PreparingQuery), queryType, std::move(collectedSchemeData));
422+
YQL_ENSURE(kqpResult.PreparingQuery);
423+
FillCompileResult(std::move(kqpResult.PreparingQuery), queryType, collectedSchemeData);
425424

426425
auto now = TInstant::Now();
427426
auto duration = now - StartTime;

ydb/core/kqp/session_actor/kqp_query_state.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ std::unique_ptr<TEvTxProxySchemeCache::TEvNavigateKeySet> TKqpQueryState::BuildN
100100
return std::make_unique<TEvTxProxySchemeCache::TEvNavigateKeySet>(navigate.Release());
101101
}
102102

103+
103104
bool TKqpQueryState::SaveAndCheckCompileResult(TEvKqp::TEvCompileResponse* ev) {
104105
CompileResult = ev->CompileResult;
105106
YQL_ENSURE(CompileResult);

ydb/core/kqp/ut/view/view_ut.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#include <ydb/public/sdk/cpp/client/ydb_proto/accessor.h>
2-
31
#include <ydb/core/kqp/ut/common/kqp_ut_common.h>
42
#include <ydb/library/yql/sql/sql.h>
53
#include <ydb/library/yql/utils/log/log.h>
4+
#include <ydb/public/sdk/cpp/client/ydb_proto/accessor.h>
65

76
#include <util/folder/filelist.h>
87

@@ -96,8 +95,8 @@ int GetInteger(const TValue& value) {
9695
return TValueParser(value).GetInt32();
9796
}
9897

99-
TMaybe<bool> GetFromCache(const TQueryStats& stats) {
100-
const auto& proto = NYdb::TProtoAccessor::GetProto(stats);
98+
TMaybe<bool> GetFromCacheStat(const TQueryStats& stats) {
99+
const auto& proto = TProtoAccessor::GetProto(stats);
101100
if (!proto.Hascompilation()) {
102101
return Nothing();
103102
}
@@ -106,9 +105,9 @@ TMaybe<bool> GetFromCache(const TQueryStats& stats) {
106105

107106
void AssertFromCache(const TMaybe<TQueryStats>& stats, bool expectedValue) {
108107
UNIT_ASSERT(stats.Defined());
109-
const auto fromCache = GetFromCache(*stats);
110-
UNIT_ASSERT_C(fromCache.Defined(), stats->ToString());
111-
UNIT_ASSERT_VALUES_EQUAL_C(*fromCache, expectedValue, stats->ToString());
108+
const auto isFromCache = GetFromCacheStat(*stats);
109+
UNIT_ASSERT_C(isFromCache.Defined(), stats->ToString());
110+
UNIT_ASSERT_VALUES_EQUAL_C(*isFromCache, expectedValue, stats->ToString());
112111
}
113112

114113
void CompareResults(const TDataQueryResult& first, const TDataQueryResult& second) {

0 commit comments

Comments
 (0)