diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2023-04-07 14:01:07 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2023-04-07 14:01:07 +0300 |
commit | 88e107dbcda60d575859dc0e7add4d21d509d698 (patch) | |
tree | c4ef384772ceaf5451407de25fc554ab64df5fcb | |
parent | 486f33fb6f812329654a7b85b10e1f602557ead3 (diff) | |
download | ydb-88e107dbcda60d575859dc0e7add4d21d509d698.tar.gz |
YQL-15415 Inject Unordered under FlatMap.
-rw-r--r-- | ydb/library/yql/core/common_opt/yql_co_simple1.cpp | 7 |
1 files changed, 7 insertions, 0 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 a0b9f7ca406..e5b4ecccdf7 100644 --- a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp +++ b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp @@ -2081,6 +2081,13 @@ TExprNode::TPtr BuildEquiJoinForSqlInChain(const TExprNode::TPtr& flatMapNode, c template <bool Ordered> TExprNode::TPtr SimpleFlatMap(const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& optCtx) { + if constexpr (!Ordered) { + if (const auto sorted = node->Head().GetConstraint<TSortedConstraintNode>()) { + YQL_CLOG(DEBUG, Core) << node->Content() << " over " << *sorted << ' ' << node->Head().Content(); + return ctx.ChangeChild(*node, 0, ctx.NewCallable(node->Head().Pos(), "Unordered", {node->HeadPtr()})); + } + } + const TCoFlatMapBase self(node); const auto& lambdaBody = self.Lambda().Body().Ref(); const auto& lambdaArg = self.Lambda().Args().Arg(0).Ref(); |