Skip to content

Commit 869df79

Browse files
authored
Merge 8c21193 into 62f8e34
2 parents 62f8e34 + 8c21193 commit 869df79

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

ydb/core/kqp/opt/peephole/kqp_opt_peephole.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ TStatus ReplaceNonDetFunctionsWithParams(TExprNode::TPtr& input, TExprContext& c
8787
class TKqpPeepholeTransformer : public TOptimizeTransformerBase {
8888
public:
8989
TKqpPeepholeTransformer(TTypeAnnotationContext& typesCtx)
90-
: TOptimizeTransformerBase(nullptr, NYql::NLog::EComponent::ProviderKqp, {})
91-
, TypesCtx(typesCtx)
90+
: TOptimizeTransformerBase(&typesCtx, NYql::NLog::EComponent::ProviderKqp, {})
9291
{
9392
#define HNDL(name) "KqpPeephole-"#name, Hndl(&TKqpPeepholeTransformer::name)
9493
AddHandler(0, &TDqReplicate::Match, HNDL(RewriteReplicate));
@@ -134,13 +133,13 @@ class TKqpPeepholeTransformer : public TOptimizeTransformerBase {
134133
}
135134

136135
TMaybeNode<TExprBase> BuildWideReadTable(TExprBase node, TExprContext& ctx) {
137-
TExprBase output = KqpBuildWideReadTable(node, ctx, TypesCtx);
136+
TExprBase output = KqpBuildWideReadTable(node, ctx, *Types);
138137
DumpAppliedRule("BuildWideReadTable", node.Ptr(), output.Ptr(), ctx);
139138
return output;
140139
}
141140

142141
TMaybeNode<TExprBase> RewriteLength(TExprBase node, TExprContext& ctx) {
143-
TExprBase output = DqPeepholeRewriteLength(node, ctx, TypesCtx);
142+
TExprBase output = DqPeepholeRewriteLength(node, ctx, *Types);
144143
DumpAppliedRule("RewriteLength", node.Ptr(), output.Ptr(), ctx);
145144
return output;
146145
}
@@ -150,9 +149,6 @@ class TKqpPeepholeTransformer : public TOptimizeTransformerBase {
150149
DumpAppliedRule("RewriteKqpWriteConstraint", node.Ptr(), output.Ptr(), ctx);
151150
return output;
152151
}
153-
154-
private:
155-
TTypeAnnotationContext& TypesCtx;
156152
};
157153

158154
struct TKqpPeepholePipelineConfigurator : IPipelineConfigurator {

ydb/library/yql/dq/opt/dq_opt_peephole.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -511,18 +511,18 @@ NNodes::TExprBase DqPeepholeRewriteJoinDict(const NNodes::TExprBase& node, TExpr
511511
rightKeySelector = BuildDictKeySelector(ctx, joinDict.Pos(), rightKeys, keyTypeItems, castKeyRight);
512512
}
513513

514-
auto streamToDict = [&ctx](const TExprBase& input, const TExprNode::TPtr& keySelector) {
514+
const auto streamToDict = [&ctx](const TExprBase& input, const TExprNode::TPtr& keySelector) {
515515
return Build<TCoSqueezeToDict>(ctx, input.Pos())
516-
.Stream(input)
516+
.Stream(TCoIterator::Match(input.Raw()) ? TExprBase(ctx.RenameNode(input.Ref(), TCoToFlow::CallableName())) : input)
517517
.KeySelector(keySelector)
518518
.PayloadSelector()
519519
.Args({"item"})
520520
.Body("item")
521521
.Build()
522522
.Settings()
523-
.Add<TCoAtom>().Build("Hashed")
524-
.Add<TCoAtom>().Build("Many")
525-
.Add<TCoAtom>().Build("Compact")
523+
.Add<TCoAtom>().Build("Hashed", TNodeFlags::Default)
524+
.Add<TCoAtom>().Build("Many", TNodeFlags::Default)
525+
.Add<TCoAtom>().Build("Compact", TNodeFlags::Default)
526526
.Build()
527527
.Done();
528528
};

ydb/tests/functional/suite_tests/canondata/test_postgres.TestPGSQL.test_sql_suite_plan-jointest_join0.test_/query_14.plan

+2-7
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,18 @@
7070
"PlanNodeType": "Connection",
7171
"Plans": [
7272
{
73-
"Node Type": "FullJoin (JoinDict)-ConstantExpr",
73+
"Node Type": "FullJoin (JoinDict)",
7474
"Operators": [
7575
{
7676
"Inputs": [
7777
{
7878
"ExternalPlanNodeId": 4
7979
},
8080
{
81-
"InternalOperatorId": 1
81+
"Other": "ConstantExpression"
8282
}
8383
],
8484
"Name": "FullJoin (JoinDict)"
85-
},
86-
{
87-
"Inputs": [],
88-
"Iterator": "[{id: 1}]",
89-
"Name": "Iterator"
9085
}
9186
],
9287
"PlanNodeId": 5,

0 commit comments

Comments
 (0)