diff options
author | vvvv <vvvv@ydb.tech> | 2022-08-11 16:29:38 +0300 |
---|---|---|
committer | vvvv <vvvv@ydb.tech> | 2022-08-11 16:29:38 +0300 |
commit | b1c90cc921458200cac7ca9c853238799e91afc4 (patch) | |
tree | a33fae801159cc07436510a09f7bda1414b89de1 | |
parent | 2ae40e59dfed06d040d323f66d89f567071180b3 (diff) | |
download | ydb-b1c90cc921458200cac7ca9c853238799e91afc4.tar.gz |
support of external columns in test expressions of sublinks
-rw-r--r-- | ydb/library/yql/core/common_opt/yql_co_pgselect.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ydb/library/yql/core/common_opt/yql_co_pgselect.cpp b/ydb/library/yql/core/common_opt/yql_co_pgselect.cpp index 653606d5ca..a778aa08b5 100644 --- a/ydb/library/yql/core/common_opt/yql_co_pgselect.cpp +++ b/ydb/library/yql/core/common_opt/yql_co_pgselect.cpp @@ -410,10 +410,20 @@ std::pair<TExprNode::TPtr, TExprNode::TPtr> RewriteSubLinks(TPositionHandle pos, ctx.NewCallable(node->Pos(), "RemoveSystemMembers", { arg }) }); auto filterExpr = ctx.ReplaceNodes(testLambda->TailPtr(), { - {testLambda->Head().Child(0), originalRow}, + {testLambda->Head().Child(0), arg}, {testLambda->Head().Child(1), value}, }); + auto status = OptimizeExpr(filterExpr, filterExpr, [&](const TExprNode::TPtr& node, TExprContext& ctx) -> TExprNode::TPtr { + if (node->IsCallable("Member") && node->Child(0) == arg.Get()) { + return ctx.ChangeChild(*node, 1, ctx.NewAtom(node->Pos(), TString("_yql_join_sublink_") + ToString(it->second) + "_" + node->Child(1)->Content())); + } + + return node; + }, ctx, TOptimizeExprSettings(optCtx.Types)); + + YQL_ENSURE(status.Level != IGraphTransformer::TStatus::Error); + root = ctx.NewCallable(node->Pos(), "FromPg", { filterExpr }); break; } |