diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2023-03-27 23:00:38 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2023-03-27 23:00:38 +0300 |
commit | cb529335306503ad434a70b9e15d9e83c6f01386 (patch) | |
tree | f1c5c6a465d62f3b333f9bdf2ecd19e90cad9281 | |
parent | bab43382d26a6362af1dc15721fe52d473a9b750 (diff) | |
download | ydb-cb529335306503ad434a70b9e15d9e83c6f01386.tar.gz |
YQL-15756 Rename NothingFrom -> EmptyFrom.
9 files changed, 19 insertions, 19 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 8bed830f93..dbdd756c5d 100644 --- a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp +++ b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp @@ -1117,7 +1117,7 @@ TExprNode::TPtr OptimizeContainerIf(const TExprNode::TPtr& node, TExprContext& c if (node->Head().IsCallable("Bool")) { YQL_CLOG(DEBUG, Core) << node->Content() << " over " << node->Head().Content() << " '" << node->Head().Head().Content(); const auto value = FromString<bool>(node->Head().Head().Content()); - return ctx.WrapByCallableIf(!value, "NothingFrom", ctx.NewCallable(node->Tail().Pos(), IsList ? "AsList" : "Just", {node->TailPtr()})); + return ctx.WrapByCallableIf(!value, "EmptyFrom", ctx.NewCallable(node->Tail().Pos(), IsList ? "AsList" : "Just", {node->TailPtr()})); } return node; } diff --git a/ydb/library/yql/core/expr_nodes/yql_expr_nodes.json b/ydb/library/yql/core/expr_nodes/yql_expr_nodes.json index 238134c5d4..a277e75a49 100644 --- a/ydb/library/yql/core/expr_nodes/yql_expr_nodes.json +++ b/ydb/library/yql/core/expr_nodes/yql_expr_nodes.json @@ -373,9 +373,9 @@ "Match": {"Type": "Callable", "Name": "UnorderedSubquery"} }, { - "Name": "TCoNothingFrom", + "Name": "TCoEmptyFrom", "Base": "TCoInputBase", - "Match": {"Type": "Callable", "Name": "NothingFrom"} + "Match": {"Type": "Callable", "Name": "EmptyFrom"} }, { "Name": "TCoConditionalValueBase", diff --git a/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp b/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp index 5ddfeb4842..add7d21156 100644 --- a/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp +++ b/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp @@ -2128,7 +2128,7 @@ TExprNode::TPtr ExpandFlatMap(const TExprNode::TPtr& node, TExprContext& ctx) { return ctx.NewCallable(node->Pos(), multimap, {node->HeadPtr(), ctx.DeepCopyLambda(lambda, body.ChildrenList())}); } - if (body.IsCallable("If") && 3U == body.ChildrenSize() && 1U == body.Tail().ChildrenSize() && body.Tail().IsCallable({"List", "Nothing", "NothingFrom"}) && ( + if (body.IsCallable("If") && 3U == body.ChildrenSize() && 1U == body.Tail().ChildrenSize() && body.Tail().IsCallable({"List", "Nothing", "EmptyFrom"}) && ( (1U == body.Child(1)->ChildrenSize() && body.Child(1)->IsCallable({"AsList", "Just"})) || (2U == body.Child(1)->ChildrenSize() && body.Child(1)->IsCallable("List")))) { const bool haveSharedCallables = HaveSharedNodes(body.HeadPtr(), body.Child(1)->TailPtr(), @@ -2344,7 +2344,7 @@ template <bool Flat, bool List> TExprNode::TPtr ExpandContainerIf(const TExprNode::TPtr& input, TExprContext& ctx) { YQL_CLOG(DEBUG, CorePeepHole) << "Expand " << input->Content(); auto item = Flat ? input->TailPtr() : ctx.NewCallable(input->Tail().Pos(), List ? "AsList" : "Just", {input->TailPtr()}); - auto none = ctx.NewCallable(input->Tail().Pos(), "NothingFrom", {item}); + auto none = ctx.NewCallable(input->Tail().Pos(), "EmptyFrom", {item}); return ctx.NewCallable(input->Pos(), "If", {input->HeadPtr(), std::move(item), std::move(none)}); } @@ -5473,7 +5473,7 @@ TExprNode::TPtr OptimizeNarrowFlatMap(const TExprNode::TPtr& node, TExprContext& const auto& lambda = node->Tail(); const auto& body = lambda.Tail(); - if (body.IsCallable("If") && 1U == body.Tail().ChildrenSize() && body.Tail().IsCallable({"List", "Nothing", "NothingFrom"})) { + if (body.IsCallable("If") && 1U == body.Tail().ChildrenSize() && body.Tail().IsCallable({"List", "Nothing", "EmptyFrom"})) { const auto width = lambda.Head().ChildrenSize(); if (auto shared = FindSharedNode(body.ChildPtr(1), body.HeadPtr(), [&lambda] (const TExprNode::TPtr& node) { diff --git a/ydb/library/yql/core/type_ann/type_ann_core.cpp b/ydb/library/yql/core/type_ann/type_ann_core.cpp index c29f236aa0..ab8b638f3c 100644 --- a/ydb/library/yql/core/type_ann/type_ann_core.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_core.cpp @@ -11811,7 +11811,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> Functions["BuildTablePath"] = &BuildTablePathWrapper; Functions["WithOptionalArgs"] = &WithOptionalArgsWrapper; Functions["WithContext"] = &WithContextWrapper; - Functions["NothingFrom"] = &NothingFromWrapper; + Functions["EmptyFrom"] = &EmptyFromWrapper; Functions["DecimalDiv"] = &DecimalBinaryWrapper; Functions["DecimalMod"] = &DecimalBinaryWrapper; 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 4739cac5f5..d89b894313 100644 --- a/ydb/library/yql/core/type_ann/type_ann_list.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_list.cpp @@ -7162,7 +7162,7 @@ namespace { return IGraphTransformer::TStatus::Ok; } - IGraphTransformer::TStatus NothingFromWrapper(const TExprNode::TPtr& input, TExprNode::TPtr&, TContext& ctx) { + IGraphTransformer::TStatus EmptyFromWrapper(const TExprNode::TPtr& input, TExprNode::TPtr&, TContext& ctx) { if (!EnsureArgsCount(*input, 1, ctx.Expr)) { return IGraphTransformer::TStatus::Error; } diff --git a/ydb/library/yql/core/type_ann/type_ann_list.h b/ydb/library/yql/core/type_ann/type_ann_list.h index 7657d41cec..80d68dac41 100644 --- a/ydb/library/yql/core/type_ann/type_ann_list.h +++ b/ydb/library/yql/core/type_ann/type_ann_list.h @@ -130,6 +130,6 @@ namespace NTypeAnnImpl { IGraphTransformer::TStatus ListFlattenWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); IGraphTransformer::TStatus IterableWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); IGraphTransformer::TStatus SqueezeToListWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); - IGraphTransformer::TStatus NothingFromWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); + IGraphTransformer::TStatus EmptyFromWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx); } // namespace NTypeAnnImpl } // namespace NYql diff --git a/ydb/library/yql/core/yql_expr_constraint.cpp b/ydb/library/yql/core/yql_expr_constraint.cpp index 88ef226f24..0cac4d5748 100644 --- a/ydb/library/yql/core/yql_expr_constraint.cpp +++ b/ydb/library/yql/core/yql_expr_constraint.cpp @@ -167,7 +167,7 @@ public: Functions["ListIf"] = &TCallableConstraintTransformer::PassOrEmptyWrap<true, false>; Functions["FlatListIf"] = &TCallableConstraintTransformer::PassOrEmptyWrap<true, true>; Functions["EmptyIterator"] = &TCallableConstraintTransformer::FromEmpty; - Functions["NothingFrom"] = &TCallableConstraintTransformer::NothingFromWrap; + Functions["EmptyFrom"] = &TCallableConstraintTransformer::EmptyFromWrap; Functions["List"] = &TCallableConstraintTransformer::ListWrap; Functions["Dict"] = &TCallableConstraintTransformer::DictWrap; Functions["EmptyList"] = &TCallableConstraintTransformer::FromEmpty; @@ -314,7 +314,7 @@ private: return TStatus::Ok; } - TStatus NothingFromWrap(const TExprNode::TPtr& input, TExprNode::TPtr& output, TExprContext& ctx) const { + TStatus EmptyFromWrap(const TExprNode::TPtr& input, TExprNode::TPtr& output, TExprContext& ctx) const { auto set = input->Head().GetConstraintSet(); set.RemoveConstraint(TEmptyConstraintNode::Name()); if (!set) { diff --git a/ydb/library/yql/core/yql_opt_utils.cpp b/ydb/library/yql/core/yql_opt_utils.cpp index 50858868fa..6c4ce003ee 100644 --- a/ydb/library/yql/core/yql_opt_utils.cpp +++ b/ydb/library/yql/core/yql_opt_utils.cpp @@ -68,7 +68,7 @@ bool IsJustOrSingleAsList(const TExprNode& node) { } bool IsTransparentIfPresent(const TExprNode& node) { - return (node.IsCallable("FlatMap") || (3U == node.ChildrenSize() && node.IsCallable("IfPresent") && node.Tail().IsCallable({"Nothing", "NothingFrom"}))) + return (node.IsCallable("FlatMap") || (3U == node.ChildrenSize() && node.IsCallable("IfPresent") && node.Tail().IsCallable({"Nothing", "EmptyFrom"}))) && node.Child(1U)->Tail().IsCallable("Just"); } @@ -347,7 +347,7 @@ bool IsEmpty(const TExprNode& node, const TTypeAnnotationContext& typeCtx) { bool IsEmptyContainer(const TExprNode& node) { return node.IsCallable({"EmptyList", "EmptyDict"}) - || (1U == node.ChildrenSize() && node.IsCallable({"List", "Nothing", "EmptyIterator", "Dict", "NothingFrom"})); + || (1U == node.ChildrenSize() && node.IsCallable({"List", "Nothing", "EmptyIterator", "Dict", "EmptyFrom"})); } const TTypeAnnotationNode* RemoveOptionalType(const TTypeAnnotationNode* type) { @@ -1151,7 +1151,7 @@ TExprNode::TPtr OptimizeIfPresent(const TExprNode::TPtr& node, TExprContext& ctx .Seal().Build(); } - if (std::any_of(optionals.cbegin(), optionals.cend(), [](const TExprNode::TPtr& node) { return node->IsCallable({"Nothing","NothingFrom"}); })) { + if (std::any_of(optionals.cbegin(), optionals.cend(), [](const TExprNode::TPtr& node) { return node->IsCallable({"Nothing","EmptyFrom"}); })) { YQL_CLOG(DEBUG, Core) << node->Content() << " over Nothing."; return node->TailPtr(); } @@ -1220,14 +1220,14 @@ TExprNode::TPtr OptimizeIfPresent(const TExprNode::TPtr& node, TExprContext& ctx .Seal().Build(); } - if (lambda.Tail().IsCallable({"SafeCast", "StrictCast"}) && node->Tail().IsCallable({"Nothing","NothingFrom"}) && &lambda.Tail().Head() == &lambda.Head().Head() && + if (lambda.Tail().IsCallable({"SafeCast", "StrictCast"}) && node->Tail().IsCallable({"Nothing","EmptyFrom"}) && &lambda.Tail().Head() == &lambda.Head().Head() && ETypeAnnotationKind::Optional != node->Head().GetTypeAnn()->Cast<TOptionalExprType>()->GetItemType()->GetKind()) { YQL_CLOG(DEBUG, Core) << "Drop " << node->Content() << " with " << lambda.Tail().Content() << " and " << node->Tail().Content(); return ctx.ChangeChild(lambda.Tail(), 0U, node->HeadPtr()); } if constexpr (Cannonize) { - if (node->Tail().IsCallable({"Nothing","NothingFrom"}) && node->Tail().GetTypeAnn()->GetKind() != ETypeAnnotationKind::Pg) { + if (node->Tail().IsCallable({"Nothing","EmptyFrom"}) && node->Tail().GetTypeAnn()->GetKind() != ETypeAnnotationKind::Pg) { YQL_CLOG(DEBUG, Core) << node->Content() << " with else " << node->Tail().Content(); return ctx.NewCallable(node->Pos(), "FlatMap", { node->HeadPtr(), node->ChildPtr(1) }); } @@ -1300,7 +1300,7 @@ TExprNode::TPtr OptimizeExists(const TExprNode::TPtr& node, TExprContext& ctx) return MakeBool<true>(node->Pos(), ctx); } - if (node->Head().IsCallable({"Nothing","NothingFrom"})) { + if (node->Head().IsCallable({"Nothing","EmptyFrom"})) { YQL_CLOG(DEBUG, Core) << node->Content() << " over " << node->Head().Content(); return MakeBool<false>(node->Pos(), ctx); } diff --git a/ydb/library/yql/providers/common/mkql/yql_provider_mkql.cpp b/ydb/library/yql/providers/common/mkql/yql_provider_mkql.cpp index 0d1c3e5f5e..dbb31c0556 100644 --- a/ydb/library/yql/providers/common/mkql/yql_provider_mkql.cpp +++ b/ydb/library/yql/providers/common/mkql/yql_provider_mkql.cpp @@ -1274,7 +1274,7 @@ TMkqlCommonCallableCompiler::TShared::TShared() { return ctx.ProgramBuilder.Unwrap(opt, message, pos.File, pos.Row, pos.Column); }); - AddCallable("NothingFrom", [](const TExprNode& node, TMkqlBuildContext& ctx) { + AddCallable("EmptyFrom", [](const TExprNode& node, TMkqlBuildContext& ctx) { const auto type = BuildType(node.Head(), *node.GetTypeAnn(), ctx.ProgramBuilder); switch (node.GetTypeAnn()->GetKind()) { case ETypeAnnotationKind::Flow: @@ -1287,7 +1287,7 @@ TMkqlCommonCallableCompiler::TShared::TShared() { case ETypeAnnotationKind::Dict: return ctx.ProgramBuilder.NewDict(type, {}); default: - ythrow TNodeException(node) << "Nothing from " << *node.GetTypeAnn() << " isn't supported."; + ythrow TNodeException(node) << "Empty from " << *node.GetTypeAnn() << " isn't supported."; } }); |