Skip to content

Commit 42dbabc

Browse files
committed
Don't change section input list in some finalyzing opts if keyFilter2 is not calculated yet
commit_hash:94aba9864b41e2e37612979955e786c02a69d4d6
1 parent f4d366e commit 42dbabc

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

yt/yql/providers/yt/provider/yql_yt_horizontal_join.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,15 @@ TExprNode::TPtr THorizontalJoinOptimizer::HandleList(const TExprNode::TPtr& node
603603
size_t outNdx = JoinedMaps.size();
604604
const TExprNode* columns = nullptr;
605605
const TExprNode* ranges = nullptr;
606+
bool incompleteSectionSettings = false;
606607
if (sectionList) {
607-
auto path = TYtSection(node->Child(sectionNum)).Paths().Item(pathNum);
608+
const auto section = TYtSection(node->Child(sectionNum));
609+
const auto path = section.Paths().Item(pathNum);
610+
611+
// Section cannot be changed right now. Keep all section inputs as is (add to ExclusiveOuts)
612+
incompleteSectionSettings = NYql::HasAnySetting(section.Settings().Ref(), EYtSettingType::Take | EYtSettingType::Skip)
613+
|| HasNonEmptyKeyFilter(section);
614+
608615
columns = path.Columns().Raw();
609616
ranges = path.Ranges().Raw();
610617
}
@@ -642,7 +649,7 @@ TExprNode::TPtr THorizontalJoinOptimizer::HandleList(const TExprNode::TPtr& node
642649
auto outRowSpec = TYtTableBaseInfo::GetRowSpec(map.Output().Item(0));
643650
const bool sortedOut = outRowSpec && outRowSpec->IsSorted();
644651

645-
if (sortedOut) {
652+
if (sortedOut || incompleteSectionSettings) {
646653
if (ExclusiveOuts.find(outNdx) == ExclusiveOuts.end()) {
647654
// Sorted output cannot be joined with others
648655
outputCountIncrement = 1;
@@ -694,7 +701,7 @@ TExprNode::TPtr THorizontalJoinOptimizer::HandleList(const TExprNode::TPtr& node
694701
Worlds.emplace(map.World().Ptr(), Worlds.size());
695702
}
696703

697-
if (sortedOut) {
704+
if (sortedOut || incompleteSectionSettings) {
698705
ExclusiveOuts[outNdx].emplace_back(sectionNum, pathNum);
699706
} else {
700707
GroupedOuts[std::make_tuple(sectionNum, columns, ranges)][outNdx] = pathNum;

yt/yql/providers/yt/provider/yql_yt_physical_finalizing.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,6 +2150,12 @@ class TYtPhysicalFinalizingTransformer : public TSyncTransformerBase {
21502150
// Used in unknown callables. Don't process
21512151
exclusiveOuts.insert(outIndex);
21522152
}
2153+
if (section && (NYql::HasAnySetting(*section->Child(TYtSection::idx_Settings), EYtSettingType::Take | EYtSettingType::Skip)
2154+
|| HasNonEmptyKeyFilter(TYtSection(section))))
2155+
{
2156+
exclusiveOuts.insert(outIndex);
2157+
}
2158+
21532159
// Section may be used multiple times in different operations
21542160
// So, check only unique pair of operation + section
21552161
if (!duplicateCheck[outIndex].insert(std::make_pair(op, section)).second) {

0 commit comments

Comments
 (0)