From 3ccd9e644dff6e58a32e5da9b1fdba712f73fca7 Mon Sep 17 00:00:00 2001 From: Vitaly Stoyan Date: Sat, 2 Nov 2024 17:51:01 +0300 Subject: [PATCH] Replay YT anonymous table name (#11219) --- .../provider/yql_yt_intent_determination.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ydb/library/yql/providers/yt/provider/yql_yt_intent_determination.cpp b/ydb/library/yql/providers/yt/provider/yql_yt_intent_determination.cpp index f70d50a7cd5f..a0d77f2d60c3 100644 --- a/ydb/library/yql/providers/yt/provider/yql_yt_intent_determination.cpp +++ b/ydb/library/yql/providers/yt/provider/yql_yt_intent_determination.cpp @@ -16,6 +16,8 @@ namespace NYql { using namespace NNodes; +const TString YtProvider_AnonTableName = "YtProvider_AnonTableName"; + class TYtIntentDeterminationTransformer : public TVisitorTransformerBase { public: TYtIntentDeterminationTransformer(TYtState::TPtr state) @@ -453,7 +455,22 @@ class TYtIntentDeterminationTransformer : public TVisitorTransformerBase { void RegisterAnonymouseTable(const TString& cluster, const TString& label) { auto& path = State_->AnonymousLabels[std::make_pair(cluster, label)]; if (path.empty()) { - path = "tmp/" + GetGuidAsString(State_->Types->RandomProvider->GenGuid()); + auto& qContext = State_->Types->QContext; + const TString key = cluster + "." + label; + if (qContext.CanRead()) { + auto res = qContext.GetReader()->Get({YtProvider_AnonTableName, key}).GetValueSync(); + if (!res) { + ythrow yexception() << "Missing replay data"; + } + + path = res->Value; + } else { + path = "tmp/" + GetGuidAsString(State_->Types->RandomProvider->GenGuid()); + if (qContext.CanWrite()) { + qContext.GetWriter()->Put({YtProvider_AnonTableName, key}, path).GetValueSync(); + } + } + YQL_CLOG(INFO, ProviderYt) << "Anonymous label " << cluster << '.' << label << ": " << path; } }