diff options
author | udovichenko-r <rvu@ydb.tech> | 2023-11-21 13:03:35 +0300 |
---|---|---|
committer | udovichenko-r <rvu@ydb.tech> | 2023-11-21 15:25:44 +0300 |
commit | 4a34710b9b00e816d783c63191559c82fcaf78b5 (patch) | |
tree | 03bac7651eb30abc8da991a16c6d9a9a5cd7102d | |
parent | 1eda4dd4f9ac1ba457c1b73a9ce9cb450f50b132 (diff) | |
download | ydb-4a34710b9b00e816d783c63191559c82fcaf78b5.tar.gz |
[yt provider] Fix MergeMultiOuts optimizer
YQL-17155
-rw-r--r-- | ydb/library/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/ydb/library/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp b/ydb/library/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp index 5425cba8af..16784b31ae 100644 --- a/ydb/library/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp +++ b/ydb/library/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp @@ -2041,8 +2041,7 @@ private: rewrite[writer] = newOp; newOps[writer] = newOp; - TVector<TExprNode::TPtr> newOuts; - newOuts.resize(outCount); + TNodeOnNodeOwnedMap newOuts; TNodeSet processed; for (auto& reader: x.second) { auto oldOutput = TYtOutput(std::get<2>(reader)); @@ -2058,7 +2057,7 @@ private: .Done().Ptr(); rewrite[oldOutput.Raw()] = newOut; if (!outRemap[oldNdx].second) { - newOuts[oldNdx] = newOut; + newOuts[oldOutput.Raw()] = newOut; } } } @@ -2071,11 +2070,10 @@ private: TVector<TYtPath> updatedPaths; for (auto path: section.Paths()) { if (path.Table().Maybe<TYtOutput>().Operation().Raw() == writer) { - auto oldNdx = FromString<size_t>(path.Table().Cast<TYtOutput>().OutIndex().Value()); - if (newOuts[oldNdx]) { + if (auto it = newOuts.find(path.Table().Cast<TYtOutput>().Raw()); it != newOuts.cend()) { updatedPaths.push_back(Build<TYtPath>(ctx, path.Pos()) .InitFrom(path) - .Table(newOuts[oldNdx]) + .Table(it->second) .Done()); } updated = true; @@ -2101,9 +2099,8 @@ private: TExprNode::TListType updatedOuts; for (auto out: publish.Input()) { if (out.Operation().Raw() == writer) { - auto oldNdx = FromString<size_t>(out.OutIndex().Value()); - if (newOuts[oldNdx]) { - updatedOuts.push_back(newOuts[oldNdx]); + if (auto it = newOuts.find(out.Raw()); it != newOuts.cend()) { + updatedOuts.push_back(it->second); } updated = true; } else { |