Skip to content

Commit

Permalink
Replay YT anonymous table name (ydb-platform#11219)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitstn committed Nov 2, 2024
1 parent a445d97 commit 3ccd9e6
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace NYql {

using namespace NNodes;

const TString YtProvider_AnonTableName = "YtProvider_AnonTableName";

class TYtIntentDeterminationTransformer : public TVisitorTransformerBase {
public:
TYtIntentDeterminationTransformer(TYtState::TPtr state)
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 3ccd9e6

Please sign in to comment.