aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora-romanov <Anton.Romanov@ydb.tech>2023-05-23 23:59:57 +0300
committera-romanov <Anton.Romanov@ydb.tech>2023-05-23 23:59:57 +0300
commit568cf2d405812450db0298f1fe9446b8d19561e3 (patch)
tree09c9537ba8942fe0989ca24f28ae90fdb9d796f8
parentf226b4c70c88ac967c94d4e55ed92a117764ff6e (diff)
downloadydb-568cf2d405812450db0298f1fe9446b8d19561e3.tar.gz
YQL-15986 Replace unordered Merge on Extend.
-rw-r--r--ydb/library/yql/core/common_opt/yql_co_simple1.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp
index 524a38a3f3..077960b434 100644
--- a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp
+++ b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp
@@ -167,7 +167,7 @@ TExprNode::TPtr ExpandFlattenEquiJoin(const TExprNode::TPtr& node, TExprContext&
TExprNode::TListType settingsChildren;
bool hasFlatten = false;
for (auto& child : settings->Children()) {
- if (child->ChildrenSize() > 0 && child->Head().Content() == "flatten") {
+ if (child->ChildrenSize() > 0 && child->Head().IsAtom("flatten")) {
hasFlatten = true;
continue;
}
@@ -3334,6 +3334,14 @@ TExprNode::TPtr OptimizeExtend(const TExprNode::TPtr& node, TExprContext& ctx, T
return node;
}
+TExprNode::TPtr OptimizeMerge(const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& optCtx) {
+ if (!node->GetConstraint<TSortedConstraintNode>()) {
+ YQL_CLOG(DEBUG, Core) << node->Content() << " with unordered output.";
+ return ctx.RenameNode(*node, "Extend");
+ }
+ return OptimizeExtend<true>(node, ctx, optCtx);
+}
+
} // namespace
void RegisterCoSimpleCallables1(TCallableOptimizerMap& map) {
@@ -3842,7 +3850,8 @@ void RegisterCoSimpleCallables1(TCallableOptimizerMap& map) {
map["SkipWhileInclusive"] = std::bind(&OptimizeWhile<false, true>, _1, _2);
map[TCoExtend::CallableName()] = std::bind(&OptimizeExtend<false>, _1, _2, _3);
- map[TCoOrderedExtend::CallableName()] = map[TCoMerge::CallableName()] = std::bind(&OptimizeExtend<true>, _1, _2, _3);
+ map[TCoOrderedExtend::CallableName()] = std::bind(&OptimizeExtend<true>, _1, _2, _3);
+ map[TCoMerge::CallableName()] = std::bind(&OptimizeMerge, _1, _2, _3);
map["ForwardList"] = [](const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& /*optCtx*/) {
if (node->Head().IsCallable("Iterator")) {