aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvvvv <vvvv@ydb.tech>2023-02-22 12:19:48 +0300
committervvvv <vvvv@ydb.tech>2023-02-22 12:19:48 +0300
commitf5c229ce02c5a7ce2c1b1682f7794cdc2d0a236a (patch)
tree2ec611a075279e7df4c9b1ef90745cfe325156bd
parent0ea27ac1aa2ba630655a95517e3d5fc51a5253f6 (diff)
downloadydb-f5c229ce02c5a7ce2c1b1682f7794cdc2d0a236a.tar.gz
can't cache pattern if mkql code was transformed
-rw-r--r--ydb/library/yql/dq/runtime/dq_tasks_runner.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/ydb/library/yql/dq/runtime/dq_tasks_runner.cpp b/ydb/library/yql/dq/runtime/dq_tasks_runner.cpp
index 9b15874ccaa..c00ee72aa57 100644
--- a/ydb/library/yql/dq/runtime/dq_tasks_runner.cpp
+++ b/ydb/library/yql/dq/runtime/dq_tasks_runner.cpp
@@ -304,7 +304,8 @@ public:
return opts;
}
- std::shared_ptr<TPatternCacheEntry> CreateComputationPattern(const NDqProto::TDqTask& task, const TString& rawProgram, bool forCache) {
+ std::shared_ptr<TPatternCacheEntry> CreateComputationPattern(const NDqProto::TDqTask& task, const TString& rawProgram, bool forCache, bool& canBeCached) {
+ canBeCached = true;
auto entry = TComputationPatternLRUCache::CreateCacheEntry(UseSeparatePatternAlloc());
auto& patternAlloc = UseSeparatePatternAlloc() ? entry->Alloc : Alloc();
auto& patternEnv = UseSeparatePatternAlloc() ? entry->Env : TypeEnv();
@@ -329,6 +330,9 @@ public:
explorer.Walk(programRoot.GetNode(), patternEnv);
bool wereChanges = false;
programRoot = SinglePassVisitCallables(programRoot, explorer, Context.FuncProvider, patternEnv, true, wereChanges);
+ if (wereChanges) {
+ canBeCached = false;
+ }
}
entry->OutputItemTypes.resize(task.OutputsSize());
@@ -417,12 +421,13 @@ public:
YQL_ENSURE(program.GetRuntimeVersion() <= NYql::NDqProto::ERuntimeVersion::RUNTIME_VERSION_YQL_1_0);
std::shared_ptr<TPatternCacheEntry> entry;
+ bool canBeCached;
if (UseSeparatePatternAlloc() && Context.PatternCache) {
auto& cache = Context.PatternCache;
auto ticket = cache->FindOrSubscribe(program.GetRaw());
if (!ticket.HasFuture()) {
- entry = CreateComputationPattern(task, program.GetRaw(), true);
- if (entry->Pattern->GetSuitableForCache()) {
+ entry = CreateComputationPattern(task, program.GetRaw(), true, canBeCached);
+ if (canBeCached && entry->Pattern->GetSuitableForCache()) {
cache->EmplacePattern(task.GetProgram().GetRaw(), entry);
ticket.Close();
} else {
@@ -434,7 +439,7 @@ public:
}
if (!entry) {
- entry = CreateComputationPattern(task, program.GetRaw(), false);
+ entry = CreateComputationPattern(task, program.GetRaw(), false, canBeCached);
}
AllocatedHolder->ProgramParsed.PatternCacheEntry = entry;