Skip to content

Commit 971e280

Browse files
committed
Move flags checking to separate function
1 parent c1388c3 commit 971e280

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

ydb/library/yql/providers/dq/opt/physical_optimize.cpp

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -241,18 +241,7 @@ class TDqsPhysicalOptProposalTransformer : public TOptimizeTransformerBase {
241241
return DqRewriteLeftPureJoin(node, ctx, *getParents(), IsGlobal);
242242
}
243243

244-
TMaybeNode<TExprBase> RewriteStreamLookupJoin(TExprBase node, TExprContext& ctx) {
245-
const auto join = node.Cast<TDqJoin>();
246-
if (join.JoinAlgo().StringValue() != "StreamLookupJoin") {
247-
return node;
248-
}
249-
250-
const auto pos = node.Pos();
251-
const auto left = join.LeftInput().Maybe<TDqConnection>();
252-
if (!left) {
253-
return node;
254-
}
255-
244+
bool ValidateStreamLookupJoinFlags(const TDqJoin& join, TExprContext& ctx) {
256245
bool leftAny = false;
257246
bool rightAny = false;
258247
if (const auto maybeFlags = join.Flags()) {
@@ -268,17 +257,35 @@ class TDqsPhysicalOptProposalTransformer : public TOptimizeTransformerBase {
268257
}
269258
if (leftAny) {
270259
ctx.AddError(TIssue(ctx.GetPosition(maybeFlags.Cast().Pos()), "Streamlookup ANY LEFT join is not implemented"));
271-
return {};
260+
return false;
272261
}
273262
}
274263
if (!rightAny) {
275264
if (false) { // Tempoarily change to waring to allow for smooth transition
276-
ctx.AddError(TIssue(ctx.GetPosition(join.Pos()), "Streamlookup: must be LEFT JOIN ANY"));
277-
return {};
265+
ctx.AddError(TIssue(ctx.GetPosition(join.Pos()), "Streamlookup: must be LEFT JOIN /*+streamlookup(...)*/ ANY"));
266+
return false;
278267
} else {
279268
ctx.AddWarning(TIssue(ctx.GetPosition(join.Pos()), "(Deprecation) Streamlookup: must be LEFT JOIN /*+streamlookup(...)*/ ANY"));
280269
}
281270
}
271+
return true;
272+
}
273+
274+
TMaybeNode<TExprBase> RewriteStreamLookupJoin(TExprBase node, TExprContext& ctx) {
275+
const auto join = node.Cast<TDqJoin>();
276+
if (join.JoinAlgo().StringValue() != "StreamLookupJoin") {
277+
return node;
278+
}
279+
280+
const auto pos = node.Pos();
281+
const auto left = join.LeftInput().Maybe<TDqConnection>();
282+
if (!left) {
283+
return node;
284+
}
285+
286+
if (!ValidateStreamLookupJoinFlags(join, ctx)) {
287+
return {};
288+
}
282289

283290
TExprNode::TPtr ttl;
284291
TExprNode::TPtr maxCachedRows;

0 commit comments

Comments
 (0)