-
Notifications
You must be signed in to change notification settings - Fork 694
parse and pass streamlookup parameters, YDB part #12548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5496d71
81a3bd2
52d6828
ece70c3
5cf0aba
8099b23
1df8ac8
8332ce5
e1d845c
5fb0d83
c1388c3
971e280
1562c68
4048e8e
59188b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,6 +241,36 @@ class TDqsPhysicalOptProposalTransformer : public TOptimizeTransformerBase { | |
return DqRewriteLeftPureJoin(node, ctx, *getParents(), IsGlobal); | ||
} | ||
|
||
bool ValidateStreamLookupJoinFlags(const TDqJoin& join, TExprContext& ctx) { | ||
bool leftAny = false; | ||
bool rightAny = false; | ||
if (const auto maybeFlags = join.Flags()) { | ||
for (auto&& flag: maybeFlags.Cast()) { | ||
auto&& name = flag.StringValue(); | ||
if (name == "LeftAny"sv) { | ||
leftAny = true; | ||
continue; | ||
} else if (name == "RightAny"sv) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. else избыточен There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Да, но, кмк, в случае исключающих альтернатив, использовать всегда |
||
rightAny = true; | ||
continue; | ||
} | ||
} | ||
if (leftAny) { | ||
ctx.AddError(TIssue(ctx.GetPosition(maybeFlags.Cast().Pos()), "Streamlookup ANY LEFT join is not implemented")); | ||
return false; | ||
} | ||
} | ||
if (!rightAny) { | ||
if (false) { // Tempoarily change to waring to allow for smooth transition | ||
ctx.AddError(TIssue(ctx.GetPosition(join.Pos()), "Streamlookup: must be LEFT JOIN /*+streamlookup(...)*/ ANY")); | ||
return false; | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. else избыточен There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Аналогично. И тут похожий код в обеих ветках, одинаковый отступ упрощает сравнение. |
||
ctx.AddWarning(TIssue(ctx.GetPosition(join.Pos()), "(Deprecation) Streamlookup: must be LEFT JOIN /*+streamlookup(...)*/ ANY")); | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
TMaybeNode<TExprBase> RewriteStreamLookupJoin(TExprBase node, TExprContext& ctx) { | ||
const auto join = node.Cast<TDqJoin>(); | ||
if (join.JoinAlgo().StringValue() != "StreamLookupJoin") { | ||
|
@@ -252,6 +282,36 @@ class TDqsPhysicalOptProposalTransformer : public TOptimizeTransformerBase { | |
if (!left) { | ||
return node; | ||
} | ||
|
||
if (!ValidateStreamLookupJoinFlags(join, ctx)) { | ||
return {}; | ||
} | ||
|
||
TExprNode::TPtr ttl; | ||
yumkam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TExprNode::TPtr maxCachedRows; | ||
TExprNode::TPtr maxDelayedRows; | ||
if (const auto maybeOptions = join.JoinAlgoOptions()) { | ||
for (auto&& option: maybeOptions.Cast()) { | ||
auto&& name = option.Name().Value(); | ||
if (name == "TTL"sv) { | ||
ttl = option.Value().Cast().Ptr(); | ||
} else if (name == "MaxCachedRows"sv) { | ||
maxCachedRows = option.Value().Cast().Ptr(); | ||
} else if (name == "MaxDelayedRows"sv) { | ||
maxDelayedRows = option.Value().Cast().Ptr(); | ||
} | ||
} | ||
} | ||
|
||
if (!ttl) { | ||
ttl = ctx.NewAtom(pos, 300); | ||
} | ||
if (!maxCachedRows) { | ||
maxCachedRows = ctx.NewAtom(pos, 1'000'000); | ||
} | ||
if (!maxDelayedRows) { | ||
maxDelayedRows = ctx.NewAtom(pos, 1'000'000); | ||
} | ||
auto cn = Build<TDqCnStreamLookup>(ctx, pos) | ||
.Output(left.Output().Cast()) | ||
.LeftLabel(join.LeftLabel().Cast<NNodes::TCoAtom>()) | ||
|
@@ -261,9 +321,9 @@ class TDqsPhysicalOptProposalTransformer : public TOptimizeTransformerBase { | |
.JoinType(join.JoinType()) | ||
.LeftJoinKeyNames(join.LeftJoinKeyNames()) | ||
.RightJoinKeyNames(join.RightJoinKeyNames()) | ||
.TTL(ctx.NewAtom(pos, 300)) //TODO configure me | ||
.MaxCachedRows(ctx.NewAtom(pos, 1'000'000)) //TODO configure me | ||
.MaxDelayedRows(ctx.NewAtom(pos, 1'000'000)) //Configure me | ||
.TTL(ttl) | ||
.MaxCachedRows(maxCachedRows) | ||
.MaxDelayedRows(maxDelayedRows) | ||
.Done(); | ||
|
||
auto lambda = Build<TCoLambda>(ctx, pos) | ||
|
Uh oh!
There was an error while loading. Please reload this page.