Skip to content

Commit b234935

Browse files
authored
Replay YT anonymous table name (#11219)
1 parent 07d6655 commit b234935

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

ydb/library/yql/providers/yt/provider/yql_yt_intent_determination.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ namespace NYql {
1616

1717
using namespace NNodes;
1818

19+
const TString YtProvider_AnonTableName = "YtProvider_AnonTableName";
20+
1921
class TYtIntentDeterminationTransformer : public TVisitorTransformerBase {
2022
public:
2123
TYtIntentDeterminationTransformer(TYtState::TPtr state)
@@ -453,7 +455,22 @@ class TYtIntentDeterminationTransformer : public TVisitorTransformerBase {
453455
void RegisterAnonymouseTable(const TString& cluster, const TString& label) {
454456
auto& path = State_->AnonymousLabels[std::make_pair(cluster, label)];
455457
if (path.empty()) {
456-
path = "tmp/" + GetGuidAsString(State_->Types->RandomProvider->GenGuid());
458+
auto& qContext = State_->Types->QContext;
459+
const TString key = cluster + "." + label;
460+
if (qContext.CanRead()) {
461+
auto res = qContext.GetReader()->Get({YtProvider_AnonTableName, key}).GetValueSync();
462+
if (!res) {
463+
ythrow yexception() << "Missing replay data";
464+
}
465+
466+
path = res->Value;
467+
} else {
468+
path = "tmp/" + GetGuidAsString(State_->Types->RandomProvider->GenGuid());
469+
if (qContext.CanWrite()) {
470+
qContext.GetWriter()->Put({YtProvider_AnonTableName, key}, path).GetValueSync();
471+
}
472+
}
473+
457474
YQL_CLOG(INFO, ProviderYt) << "Anonymous label " << cluster << '.' << label << ": " << path;
458475
}
459476
}

0 commit comments

Comments
 (0)