diff --git a/ydb/core/kqp/opt/peephole/kqp_opt_peephole.cpp b/ydb/core/kqp/opt/peephole/kqp_opt_peephole.cpp index b8ac524ff96b..bbb3dd54d221 100644 --- a/ydb/core/kqp/opt/peephole/kqp_opt_peephole.cpp +++ b/ydb/core/kqp/opt/peephole/kqp_opt_peephole.cpp @@ -87,8 +87,7 @@ TStatus ReplaceNonDetFunctionsWithParams(TExprNode::TPtr& input, TExprContext& c class TKqpPeepholeTransformer : public TOptimizeTransformerBase { public: TKqpPeepholeTransformer(TTypeAnnotationContext& typesCtx) - : TOptimizeTransformerBase(nullptr, NYql::NLog::EComponent::ProviderKqp, {}) - , TypesCtx(typesCtx) + : TOptimizeTransformerBase(&typesCtx, NYql::NLog::EComponent::ProviderKqp, {}) { #define HNDL(name) "KqpPeephole-"#name, Hndl(&TKqpPeepholeTransformer::name) AddHandler(0, &TDqReplicate::Match, HNDL(RewriteReplicate)); @@ -134,13 +133,13 @@ class TKqpPeepholeTransformer : public TOptimizeTransformerBase { } TMaybeNode BuildWideReadTable(TExprBase node, TExprContext& ctx) { - TExprBase output = KqpBuildWideReadTable(node, ctx, TypesCtx); + TExprBase output = KqpBuildWideReadTable(node, ctx, *Types); DumpAppliedRule("BuildWideReadTable", node.Ptr(), output.Ptr(), ctx); return output; } TMaybeNode RewriteLength(TExprBase node, TExprContext& ctx) { - TExprBase output = DqPeepholeRewriteLength(node, ctx, TypesCtx); + TExprBase output = DqPeepholeRewriteLength(node, ctx, *Types); DumpAppliedRule("RewriteLength", node.Ptr(), output.Ptr(), ctx); return output; } @@ -150,9 +149,6 @@ class TKqpPeepholeTransformer : public TOptimizeTransformerBase { DumpAppliedRule("RewriteKqpWriteConstraint", node.Ptr(), output.Ptr(), ctx); return output; } - -private: - TTypeAnnotationContext& TypesCtx; }; struct TKqpPeepholePipelineConfigurator : IPipelineConfigurator { diff --git a/ydb/library/yql/dq/opt/dq_opt_peephole.cpp b/ydb/library/yql/dq/opt/dq_opt_peephole.cpp index 11877696b431..6ce322bfc502 100644 --- a/ydb/library/yql/dq/opt/dq_opt_peephole.cpp +++ b/ydb/library/yql/dq/opt/dq_opt_peephole.cpp @@ -511,18 +511,18 @@ NNodes::TExprBase DqPeepholeRewriteJoinDict(const NNodes::TExprBase& node, TExpr rightKeySelector = BuildDictKeySelector(ctx, joinDict.Pos(), rightKeys, keyTypeItems, castKeyRight); } - auto streamToDict = [&ctx](const TExprBase& input, const TExprNode::TPtr& keySelector) { + const auto streamToDict = [&ctx](const TExprBase& input, const TExprNode::TPtr& keySelector) { return Build(ctx, input.Pos()) - .Stream(input) + .Stream(TCoIterator::Match(input.Raw()) ? TExprBase(ctx.RenameNode(input.Ref(), TCoToFlow::CallableName())) : input) .KeySelector(keySelector) .PayloadSelector() .Args({"item"}) .Body("item") .Build() .Settings() - .Add().Build("Hashed") - .Add().Build("Many") - .Add().Build("Compact") + .Add().Build("Hashed", TNodeFlags::Default) + .Add().Build("Many", TNodeFlags::Default) + .Add().Build("Compact", TNodeFlags::Default) .Build() .Done(); }; diff --git a/ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_join0.test_/query_14.plan b/ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_join0.test_/query_14.plan index f309a146c2ef..a32ec829c056 100644 --- a/ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_join0.test_/query_14.plan +++ b/ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_join0.test_/query_14.plan @@ -70,7 +70,7 @@ "PlanNodeType": "Connection", "Plans": [ { - "Node Type": "FullJoin (JoinDict)-ConstantExpr", + "Node Type": "FullJoin (JoinDict)", "Operators": [ { "Inputs": [ @@ -78,15 +78,10 @@ "ExternalPlanNodeId": 4 }, { - "InternalOperatorId": 1 + "Other": "ConstantExpression" } ], "Name": "FullJoin (JoinDict)" - }, - { - "Inputs": [], - "Iterator": "[{id: 1}]", - "Name": "Iterator" } ], "PlanNodeId": 5,