Skip to content
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

Fix plans and cannonize tests with aggr functions. #550

Merged
merged 3 commits into from
Dec 19, 2023
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
2 changes: 1 addition & 1 deletion ydb/core/kqp/ut/query/kqp_explain_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Y_UNIT_TEST_SUITE(KqpExplain) {
UNIT_ASSERT(aggregate.IsDefined());
UNIT_ASSERT(aggregate.GetMapSafe().at("GroupBy").GetStringSafe() == "item.App");
UNIT_ASSERT(aggregate.GetMapSafe().at("Aggregation").GetStringSafe() ==
"{_yql_agg_0: MAX(item.Message),_yql_agg_1: MIN(item.Message)}");
"{_yql_agg_0: MAX(item.Message,state._yql_agg_0),_yql_agg_1: MIN(item.Message,state._yql_agg_1)}");
}

Y_UNIT_TEST(ComplexJoin) {
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/yql/utils/plan/plan_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ TString PrettyExprStr(const TExprBase& expr) {
return AggrOpToStr(expr);
} else if (aggregations.contains(expr.Ref().Content())) {
return TStringBuilder() << aggregations.at(expr.Ref().Content()) << "("
<< PrettyExprStr(TExprBase(expr.Ref().Child(0))) << ")";
<< PrettyExprStr(TExprBase(expr.Ref().Child(0))) << ',' << PrettyExprStr(TExprBase(expr.Ref().Child(1))) << ")";
} else if (expr.Maybe<TCoBinaryArithmetic>() || expr.Maybe<TCoCompare>()) {
return BinaryOpToStr(expr);
} else if (expr.Maybe<TCoAnd>() || expr.Maybe<TCoOr>() || expr.Maybe<TCoXor>()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"Operators": [
{
"GroupBy": "item.Group",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"Name": "Aggregate"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
"Operators": [
{
"GroupBy": "item.Group",
"Aggregation": "{_yql_agg_0: MIN(item.Amount)}",
"Aggregation": "{_yql_agg_0: MIN(item.Amount,state._yql_agg_0)}",
"Name": "Aggregate"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "item.SearchPhrase",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "item.UserID",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0),_yql_agg_1: MIN(item.URL)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1),_yql_agg_1: MIN(item.URL,state._yql_agg_1)}",
"GroupBy": "item.SearchPhrase",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0),_yql_agg_2: MIN(item.URL),_yql_agg_3: MIN(item.Title)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1),_yql_agg_2: MIN(item.URL,state._yql_agg_2),_yql_agg_3: MIN(item.Title,state._yql_agg_3)}",
"GroupBy": "item.SearchPhrase",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_1: SUM(state._yql_agg_1)}",
"Aggregation": "{_yql_agg_1: SUM(state._yql_agg_1,1)}",
"GroupBy": "item.CounterID",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_1: SUM(state._yql_agg_1),_yql_agg_2: MIN(item.Referer)}",
"Aggregation": "{_yql_agg_1: SUM(state._yql_agg_1,1),_yql_agg_2: MIN(item.Referer,state._yql_agg_2)}",
"GroupBy": "item.key",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_1: SUM(state._yql_agg_1),_yql_agg_2: SUM(item.IsRefresh)}",
"Aggregation": "{_yql_agg_1: SUM(state._yql_agg_1,1),_yql_agg_2: SUM(item.IsRefresh,state._yql_agg_2)}",
"GroupBy": "",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_1: SUM(state._yql_agg_1),_yql_agg_2: SUM(item.IsRefresh)}",
"Aggregation": "{_yql_agg_1: SUM(state._yql_agg_1,1),_yql_agg_2: SUM(item.IsRefresh,state._yql_agg_2)}",
"GroupBy": "",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_1: SUM(state._yql_agg_1),_yql_agg_2: SUM(item.IsRefresh)}",
"Aggregation": "{_yql_agg_1: SUM(state._yql_agg_1,1),_yql_agg_2: SUM(item.IsRefresh,state._yql_agg_2)}",
"GroupBy": "",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "item.URL",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"Node Type": "Aggregate-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"Node Type": "Aggregate-Filter-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "item.URL",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"Node Type": "Aggregate-Filter-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "item.Title",
"Name": "Aggregate"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"Node Type": "Limit",
"Operators": [
{
"Limit": "10 + 1000",
"Limit": "SUM(10,1000)",
"Name": "Limit"
}
],
Expand All @@ -52,7 +52,7 @@
"Node Type": "TopSort",
"Operators": [
{
"Limit": "10 + 1000",
"Limit": "SUM(10,1000)",
"Name": "TopSort",
"TopSortBy": "argument.Count0"
}
Expand All @@ -71,7 +71,7 @@
"Node Type": "Aggregate-Filter-TableFullScan",
"Operators": [
{
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0)}",
"Aggregation": "{_yql_agg_0: SUM(state._yql_agg_0,1)}",
"GroupBy": "item.URL",
"Name": "Aggregate"
},
Expand Down
Loading
Loading