Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions ydb/core/kqp/opt/peephole/kqp_opt_peephole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -134,13 +133,13 @@ class TKqpPeepholeTransformer : public TOptimizeTransformerBase {
}

TMaybeNode<TExprBase> 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<TExprBase> 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;
}
Expand All @@ -150,9 +149,6 @@ class TKqpPeepholeTransformer : public TOptimizeTransformerBase {
DumpAppliedRule("RewriteKqpWriteConstraint", node.Ptr(), output.Ptr(), ctx);
return output;
}

private:
TTypeAnnotationContext& TypesCtx;
};

struct TKqpPeepholePipelineConfigurator : IPipelineConfigurator {
Expand Down
10 changes: 5 additions & 5 deletions ydb/library/yql/dq/opt/dq_opt_peephole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<TCoSqueezeToDict>(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<TCoAtom>().Build("Hashed")
.Add<TCoAtom>().Build("Many")
.Add<TCoAtom>().Build("Compact")
.Add<TCoAtom>().Build("Hashed", TNodeFlags::Default)
.Add<TCoAtom>().Build("Many", TNodeFlags::Default)
.Add<TCoAtom>().Build("Compact", TNodeFlags::Default)
.Build()
.Done();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,18 @@
"PlanNodeType": "Connection",
"Plans": [
{
"Node Type": "FullJoin (JoinDict)-ConstantExpr",
"Node Type": "FullJoin (JoinDict)",
"Operators": [
{
"Inputs": [
{
"ExternalPlanNodeId": 4
},
{
"InternalOperatorId": 1
"Other": "ConstantExpression"
}
],
"Name": "FullJoin (JoinDict)"
},
{
"Inputs": [],
"Iterator": "[{id: 1}]",
"Name": "Iterator"
}
],
"PlanNodeId": 5,
Expand Down