Skip to content

switch on aggregations pushdown into CS #7305

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

Merged
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
5 changes: 0 additions & 5 deletions ydb/core/kqp/opt/physical/kqp_opt_phy_olap_agg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,6 @@ TExprBase KqpPushOlapAggregate(TExprBase node, TExprContext& ctx, const TKqpOpti
return node;
}

// temporary for keys grouping push down not useful
if (!aggCombine.Keys().Empty()) {
return node;
}

auto read = maybeRead.Cast();
auto aggs = Build<TKqpOlapAggOperationList>(ctx, node.Pos());

Expand Down
4 changes: 2 additions & 2 deletions ydb/core/kqp/ut/olap/aggregations_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Y_UNIT_TEST_SUITE(KqpOlapAggregations) {

// Check plan
#if SSA_RUNTIME_VERSION >= 2U
CheckPlanForAggregatePushdown(query, tableClient, { "WideCombiner" }, "Aggregate-TableFullScan");
CheckPlanForAggregatePushdown(query, tableClient, { "WideCombiner" }, "TableFullScan");
// CheckPlanForAggregatePushdown(query, tableClient, { "TKqpOlapAgg" }, "TableFullScan");
#else
CheckPlanForAggregatePushdown(query, tableClient, { "CombineCore" }, "");
Expand Down Expand Up @@ -980,7 +980,7 @@ Y_UNIT_TEST_SUITE(KqpOlapAggregations) {
ORDER BY c, resource_id DESC LIMIT 3
)")
.SetExpectedReply("[[[\"40999\"];[4];1u];[[\"40998\"];[3];1u];[[\"40997\"];[2];1u]]")
.SetExpectedReadNodeType("Aggregate-TableFullScan");
.SetExpectedReadNodeType("TableFullScan");
testCase.FillExpectedAggregationGroupByPlanOptions();
TestAggregations({ testCase });
}
Expand Down
6 changes: 3 additions & 3 deletions ydb/core/kqp/ut/olap/clickbench_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Y_UNIT_TEST_SUITE(KqpOlapClickbench) {
//.SetExpectedReply("[[[\"40999\"];[4];1u];[[\"40998\"];[3];1u];[[\"40997\"];[2];1u]]")
// Should be fixed in https://st.yandex-team.ru/KIKIMR-17009
// .SetExpectedReadNodeType("TableFullScan");
.SetExpectedReadNodeType("Aggregate-TableFullScan");
.SetExpectedReadNodeType("TableFullScan");
q7.FillExpectedAggregationGroupByPlanOptions();

TAggregationTestCase q9;
Expand Down Expand Up @@ -185,7 +185,7 @@ Y_UNIT_TEST_SUITE(KqpOlapClickbench) {
//.SetExpectedReply("[[[\"40999\"];[4];1u];[[\"40998\"];[3];1u];[[\"40997\"];[2];1u]]")
// Should be fixed in https://st.yandex-team.ru/KIKIMR-17009
// .SetExpectedReadNodeType("TableFullScan");
.SetExpectedReadNodeType("Aggregate-TableFullScan");
.SetExpectedReadNodeType("TableFullScan");
q12.FillExpectedAggregationGroupByPlanOptions();

TAggregationTestCase q14;
Expand All @@ -201,7 +201,7 @@ Y_UNIT_TEST_SUITE(KqpOlapClickbench) {
//.SetExpectedReply("[[[\"40999\"];[4];1u];[[\"40998\"];[3];1u];[[\"40997\"];[2];1u]]")
// Should be fixed in https://st.yandex-team.ru/KIKIMR-17009
// .SetExpectedReadNodeType("TableFullScan");
.SetExpectedReadNodeType("Aggregate-TableFullScan");
.SetExpectedReadNodeType("TableFullScan");
q14.FillExpectedAggregationGroupByPlanOptions();

TAggregationTestCase q22;
Expand Down
3 changes: 2 additions & 1 deletion ydb/core/kqp/ut/olap/kqp_olap_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2520,7 +2520,8 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
UNIT_ASSERT_EQUAL_C(plan.QueryStats->Getquery_ast().find("WideFromBlocks"), plan.QueryStats->Getquery_ast().rfind("WideFromBlocks"), plan.QueryStats->Getquery_ast());
break;
case NKikimrConfig::TTableServiceConfig_EBlockChannelsMode_BLOCK_CHANNELS_FORCE:
UNIT_ASSERT_C(plan.QueryStats->Getquery_ast().Contains("return (FromFlow (WideMap"), plan.QueryStats->Getquery_ast());
UNIT_ASSERT_C(plan.QueryStats->Getquery_ast().Contains("(FromFlow (WideSortBlocks"), plan.QueryStats->Getquery_ast());
UNIT_ASSERT_C(plan.QueryStats->Getquery_ast().Contains("(FromFlow (NarrowMap (WideFromBlocks"), plan.QueryStats->Getquery_ast());
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,8 @@
"PlanNodeType": "Connection",
"Plans": [
{
"Node Type": "Aggregate-TableFullScan",
"Node Type": "TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "item.SearchPhrase",
"Inputs": [
{
"InternalOperatorId": 1
}
],
"Name": "Aggregate"
},
{
"Inputs": [],
"Name": "TableFullScan",
Expand Down Expand Up @@ -124,11 +114,33 @@
}
}
},
{
"GroupBy": {
"Aggregates": [
{
"Column": {
"Id": 108
},
"Function": {
"Id": 2
}
}
],
"KeyColumns": [
{
"Id": 40
}
]
}
},
{
"Projection": {
"Columns": [
{
"Id": 40
},
{
"Id": 108
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,8 @@
"PlanNodeType": "Connection",
"Plans": [
{
"Node Type": "Aggregate-TableFullScan",
"Node Type": "TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "",
"Inputs": [
{
"InternalOperatorId": 1
}
],
"Name": "Aggregate"
},
{
"Inputs": [],
"Name": "TableFullScan",
Expand Down Expand Up @@ -126,6 +116,28 @@
}
}
},
{
"GroupBy": {
"Aggregates": [
{
"Column": {
"Id": 108
},
"Function": {
"Id": 2
}
}
],
"KeyColumns": [
{
"Id": 39
},
{
"Id": 40
}
]
}
},
{
"Projection": {
"Columns": [
Expand All @@ -134,6 +146,9 @@
},
{
"Id": 40
},
{
"Id": 108
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,8 @@
"PlanNodeType": "Connection",
"Plans": [
{
"Node Type": "Aggregate-TableFullScan",
"Node Type": "TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "item.UserID",
"Inputs": [
{
"InternalOperatorId": 1
}
],
"Name": "Aggregate"
},
{
"Inputs": [],
"Name": "TableFullScan",
Expand All @@ -87,11 +77,33 @@
"Scan": "Parallel",
"SsaProgram": {
"Command": [
{
"GroupBy": {
"Aggregates": [
{
"Column": {
"Id": 106
},
"Function": {
"Id": 2
}
}
],
"KeyColumns": [
{
"Id": 10
}
]
}
},
{
"Projection": {
"Columns": [
{
"Id": 10
},
{
"Id": 106
}
]
}
Expand Down
Loading
Loading