summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora-romanov <[email protected]>2023-03-21 11:34:05 +0300
committera-romanov <[email protected]>2023-03-21 11:34:05 +0300
commitee334d4e9a9cb89bb53e8df2446a822705950461 (patch)
tree6c6f1bb1cc286be957e948b8dcd3c2c4e6b418c6
parent198c9240d8199d5be8fdfb65757d1b94d460a1ae (diff)
YQL-15415 Drop Unordered over maps and filters.
-rw-r--r--ydb/library/yql/core/common_opt/yql_co_simple1.cpp2
-rw-r--r--ydb/library/yql/core/type_ann/type_ann_list.cpp24
2 files changed, 19 insertions, 7 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 c7c1ca0e467..4061dab082e 100644
--- a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp
+++ b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp
@@ -5502,7 +5502,7 @@ void RegisterCoSimpleCallables1(TCallableOptimizerMap& map) {
};
map["Unordered"] = map["UnorderedSubquery"] = [](const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& /*optCtx*/) {
- if (node->Head().IsCallable({"AsList","EquiJoin"})) {
+ if (node->Head().IsCallable({"AsList","EquiJoin","Filter","Map","FlatMap","MultiMap","Extend"})) {
YQL_CLOG(DEBUG, Core) << "Drop " << node->Content() << " over " << node->Head().Content();
return node->HeadPtr();
}
diff --git a/ydb/library/yql/core/type_ann/type_ann_list.cpp b/ydb/library/yql/core/type_ann/type_ann_list.cpp
index a9f91d81b9c..3d13c329ebb 100644
--- a/ydb/library/yql/core/type_ann/type_ann_list.cpp
+++ b/ydb/library/yql/core/type_ann/type_ann_list.cpp
@@ -2489,9 +2489,15 @@ namespace {
}
IGraphTransformer::TStatus ExtendWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) {
- if (!input->ChildrenSize()) {
- output = ctx.Expr.NewCallable(input->Pos(), "EmptyList", {});
- return IGraphTransformer::TStatus::Repeat;
+ switch (input->ChildrenSize()) {
+ case 0U:
+ output = ctx.Expr.NewCallable(input->Pos(), "EmptyList", {});
+ return IGraphTransformer::TStatus::Repeat;
+ case 1U:
+ output = input->HeadPtr();
+ return IGraphTransformer::TStatus::Repeat;
+ default:
+ break;
}
const bool hasEmptyLists = AnyOf(input->Children(), IsEmptyList);
@@ -2521,9 +2527,15 @@ namespace {
}
IGraphTransformer::TStatus UnionAllWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) {
- if (!input->ChildrenSize()) {
- output = ctx.Expr.NewCallable(input->Pos(), "EmptyList", {});
- return IGraphTransformer::TStatus::Repeat;
+ switch (input->ChildrenSize()) {
+ case 0U:
+ output = ctx.Expr.NewCallable(input->Pos(), "EmptyList", {});
+ return IGraphTransformer::TStatus::Repeat;
+ case 1U:
+ output = input->HeadPtr();
+ return IGraphTransformer::TStatus::Repeat;
+ default:
+ break;
}
const bool hasEmptyLists = AnyOf(input->Children(), IsEmptyList);