diff options
author | udovichenko-r <udovichenko-r@yandex-team.com> | 2025-04-16 11:47:00 +0300 |
---|---|---|
committer | udovichenko-r <udovichenko-r@yandex-team.com> | 2025-04-16 12:05:46 +0300 |
commit | 42dbabc6de78865608c6a7b65d5714dc0eff331d (patch) | |
tree | 374a4caa4cd34a860ebf1323a5cba00223978884 | |
parent | f4d366e1882cfbae7ccda2e7a601b9fa5da09bdb (diff) | |
download | ydb-42dbabc6de78865608c6a7b65d5714dc0eff331d.tar.gz |
Don't change section input list in some finalyzing opts if keyFilter2 is not calculated yet
commit_hash:94aba9864b41e2e37612979955e786c02a69d4d6
-rw-r--r-- | yt/yql/providers/yt/provider/yql_yt_horizontal_join.cpp | 13 | ||||
-rw-r--r-- | yt/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp | 6 |
2 files changed, 16 insertions, 3 deletions
diff --git a/yt/yql/providers/yt/provider/yql_yt_horizontal_join.cpp b/yt/yql/providers/yt/provider/yql_yt_horizontal_join.cpp index 13d426e13dd..6b28a133e12 100644 --- a/yt/yql/providers/yt/provider/yql_yt_horizontal_join.cpp +++ b/yt/yql/providers/yt/provider/yql_yt_horizontal_join.cpp @@ -603,8 +603,15 @@ TExprNode::TPtr THorizontalJoinOptimizer::HandleList(const TExprNode::TPtr& node size_t outNdx = JoinedMaps.size(); const TExprNode* columns = nullptr; const TExprNode* ranges = nullptr; + bool incompleteSectionSettings = false; if (sectionList) { - auto path = TYtSection(node->Child(sectionNum)).Paths().Item(pathNum); + const auto section = TYtSection(node->Child(sectionNum)); + const auto path = section.Paths().Item(pathNum); + + // Section cannot be changed right now. Keep all section inputs as is (add to ExclusiveOuts) + incompleteSectionSettings = NYql::HasAnySetting(section.Settings().Ref(), EYtSettingType::Take | EYtSettingType::Skip) + || HasNonEmptyKeyFilter(section); + columns = path.Columns().Raw(); ranges = path.Ranges().Raw(); } @@ -642,7 +649,7 @@ TExprNode::TPtr THorizontalJoinOptimizer::HandleList(const TExprNode::TPtr& node auto outRowSpec = TYtTableBaseInfo::GetRowSpec(map.Output().Item(0)); const bool sortedOut = outRowSpec && outRowSpec->IsSorted(); - if (sortedOut) { + if (sortedOut || incompleteSectionSettings) { if (ExclusiveOuts.find(outNdx) == ExclusiveOuts.end()) { // Sorted output cannot be joined with others outputCountIncrement = 1; @@ -694,7 +701,7 @@ TExprNode::TPtr THorizontalJoinOptimizer::HandleList(const TExprNode::TPtr& node Worlds.emplace(map.World().Ptr(), Worlds.size()); } - if (sortedOut) { + if (sortedOut || incompleteSectionSettings) { ExclusiveOuts[outNdx].emplace_back(sectionNum, pathNum); } else { GroupedOuts[std::make_tuple(sectionNum, columns, ranges)][outNdx] = pathNum; diff --git a/yt/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp b/yt/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp index 902668cf11d..a24102fd0c2 100644 --- a/yt/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp +++ b/yt/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp @@ -2150,6 +2150,12 @@ private: // Used in unknown callables. Don't process exclusiveOuts.insert(outIndex); } + if (section && (NYql::HasAnySetting(*section->Child(TYtSection::idx_Settings), EYtSettingType::Take | EYtSettingType::Skip) + || HasNonEmptyKeyFilter(TYtSection(section)))) + { + exclusiveOuts.insert(outIndex); + } + // Section may be used multiple times in different operations // So, check only unique pair of operation + section if (!duplicateCheck[outIndex].insert(std::make_pair(op, section)).second) { |