Skip to content

Commit dc0256d

Browse files
authored
[KQP RBO] Add union all (#26359)
1 parent 5629fb4 commit dc0256d

10 files changed

+601
-371
lines changed

ydb/core/kqp/expr_nodes/kqp_expr_nodes.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,15 @@
843843
{"Index": 3, "Name": "JoinKeys", "Type": "TDqJoinKeyTupleList"}
844844
]
845845
},
846+
{
847+
"Name": "TKqpOpUnionAll",
848+
"Base": "TCallable",
849+
"Match": {"Type": "Callable", "Name": "KqpOpUnionAll"},
850+
"Children": [
851+
{"Index": 0, "Name": "LeftInput", "Type": "TExprBase"},
852+
{"Index": 1, "Name": "RightInput", "Type": "TExprBase"}
853+
]
854+
},
846855
{
847856
"Name": "TKqpOpLimit",
848857
"Base": "TCallable",

ydb/core/kqp/opt/kqp_type_ann.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,6 +2380,14 @@ TStatus AnnotateOpJoin(const TExprNode::TPtr& input, TExprContext& ctx) {
23802380
return TStatus::Ok;
23812381
}
23822382

2383+
TStatus AnnotateOpUnionAll(const TExprNode::TPtr& input, TExprContext& ctx) {
2384+
Y_UNUSED(ctx);
2385+
auto leftInputType = input->ChildPtr(TKqpOpJoin::idx_LeftInput)->GetTypeAnn();
2386+
// TODO: Add sanity checks.
2387+
input->SetTypeAnn(leftInputType);
2388+
return TStatus::Ok;
2389+
}
2390+
23832391
TStatus AnnotateOpLimit(const TExprNode::TPtr& input, TExprContext& ctx) {
23842392
Y_UNUSED(ctx);
23852393
const TTypeAnnotationNode* inputType = input->ChildPtr(TKqpOpRoot::idx_Input)->GetTypeAnn();
@@ -2608,6 +2616,10 @@ TAutoPtr<IGraphTransformer> CreateKqpTypeAnnotationTransformer(const TString& cl
26082616
return AnnotateOpJoin(input, ctx);
26092617
}
26102618

2619+
if (TKqpOpUnionAll::Match(input.Get())) {
2620+
return AnnotateOpUnionAll(input, ctx);
2621+
}
2622+
26112623
if (TKqpOpLimit::Match(input.Get())) {
26122624
return AnnotateOpLimit(input, ctx);
26132625
}

0 commit comments

Comments
 (0)