Skip to content

Commit 2099326

Browse files
authored
fix FindWrapStats for wide lambda (#10662)
1 parent 96d03d6 commit 2099326

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ydb/core/kqp/opt/kqp_query_plan.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -720,15 +720,17 @@ class TxPlanSerializer {
720720
}
721721
}
722722
for (const auto& child : node->Children()) {
723-
std::shared_ptr<TOptimizerStatistics> result;
724723
if (child->IsLambda()) {
725-
auto lambda = TExprBase(child).Cast<TCoLambda>();
726-
result = FindWrapStats(lambda.Body().Ptr(), dataSourceNode);
724+
// support wide lambda as well
725+
for (size_t bodyIndex = 1; bodyIndex < child->ChildrenSize(); ++bodyIndex) {
726+
if (auto result = FindWrapStats(child->ChildPtr(bodyIndex), dataSourceNode)) {
727+
return result;
728+
}
729+
}
727730
} else {
728-
result = FindWrapStats(child, dataSourceNode);
729-
}
730-
if (result) {
731-
return result;
731+
if (auto result = FindWrapStats(child, dataSourceNode)) {
732+
return result;
733+
}
732734
}
733735
}
734736
return nullptr;

0 commit comments

Comments
 (0)