diff options
author | vitya-smirnov <[email protected]> | 2025-07-15 17:01:51 +0300 |
---|---|---|
committer | vitya-smirnov <[email protected]> | 2025-07-15 17:19:51 +0300 |
commit | 64137fb0cbe9afe92dca8efc335ef9ff16b78926 (patch) | |
tree | 1f35ca0b330569f9725b3cfc2971a894b65b25f7 /yql/essentials/tests | |
parent | 6fb5119e5d0aee18cf78fb28d7f71c9539cca6dc (diff) |
YQL-20171: Fix aggregation joining key
There was a bug with a aggregation deduplication
by a column at the translator.
For a single column the system joining all
aggregations using the generic key. The
generic key was just a column name without
source name what leads to collision when
aggregating multiple different sources with
same column names.
This patch fixes the generic key by adding a
data source name there. Also tests are added.
commit_hash:1c0a9da512f68c58d2830e096de76b769b733cb2
Diffstat (limited to 'yql/essentials/tests')
4 files changed, 80 insertions, 0 deletions
diff --git a/yql/essentials/tests/sql/minirun/part2/canondata/result.json b/yql/essentials/tests/sql/minirun/part2/canondata/result.json index 26657de294b..4124a8bd764 100644 --- a/yql/essentials/tests/sql/minirun/part2/canondata/result.json +++ b/yql/essentials/tests/sql/minirun/part2/canondata/result.json @@ -167,6 +167,20 @@ "uri": "https://{canondata_backend}/1773845/e276b05a77b889bd8fbb83a0bc0087dea7abd8f4/resource.tar.gz#test.test_aggregate-yql-18511--Results_/results.txt" } ], + "test.test[aggregate-yql-20171-default.txt-Debug]": [ + { + "checksum": "8e6cd81419bf6bc83bf11927dda251bf", + "size": 4123, + "uri": "https://{canondata_backend}/1777230/f27d03c8c0734d79de836e377bb46e273f7ef515/resource.tar.gz#test.test_aggregate-yql-20171-default.txt-Debug_/opt.yql" + } + ], + "test.test[aggregate-yql-20171-default.txt-Results]": [ + { + "checksum": "63c79f8933e6829d822277bc09a52998", + "size": 4609, + "uri": "https://{canondata_backend}/1777230/f27d03c8c0734d79de836e377bb46e273f7ef515/resource.tar.gz#test.test_aggregate-yql-20171-default.txt-Results_/results.txt" + } + ], "test.test[bigdate-bitcast_timestamp64-default.txt-Debug]": [ { "checksum": "a8025a4a66a887998224f0134011f4ae", diff --git a/yql/essentials/tests/sql/sql2yql/canondata/result.json b/yql/essentials/tests/sql/sql2yql/canondata/result.json index 069f12459ea..ca885d5c66e 100644 --- a/yql/essentials/tests/sql/sql2yql/canondata/result.json +++ b/yql/essentials/tests/sql/sql2yql/canondata/result.json @@ -1035,6 +1035,13 @@ "uri": "https://{canondata_backend}/1775059/4e018163deb87c6968321bd825fc0be44b9f9802/resource.tar.gz#test_sql2yql.test_aggregate-yql-20170_/sql.yql" } ], + "test_sql2yql.test[aggregate-yql-20171]": [ + { + "checksum": "c7e854ac0cd57be40acab61f0212cc9a", + "size": 7174, + "uri": "https://{canondata_backend}/1925821/6494c0b47eb6d65247ddb7962a165f6a764c86f7/resource.tar.gz#test_sql2yql.test_aggregate-yql-20171_/sql.yql" + } + ], "test_sql2yql.test[ansi_idents-escaping]": [ { "checksum": "4870ad0bb397aa5a3edad1f634eb6e93", @@ -8565,6 +8572,11 @@ "uri": "file://test_sql_format.test_aggregate-yql-20170_/formatted.sql" } ], + "test_sql_format.test[aggregate-yql-20171]": [ + { + "uri": "file://test_sql_format.test_aggregate-yql-20171_/formatted.sql" + } + ], "test_sql_format.test[ansi_idents-escaping]": [ { "uri": "file://test_sql_format.test_ansi_idents-escaping_/formatted.sql" diff --git a/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_aggregate-yql-20171_/formatted.sql b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_aggregate-yql-20171_/formatted.sql new file mode 100644 index 00000000000..241bfd7c570 --- /dev/null +++ b/yql/essentials/tests/sql/sql2yql/canondata/test_sql_format.test_aggregate-yql-20171_/formatted.sql @@ -0,0 +1,44 @@ +SELECT + Percentile(a.x, 0.50), + Percentile(a.x, 0.75), + Percentile(a.x, 1.00) +FROM ( + VALUES + (1), + (2), + (3), + (4), + (5) +) AS a ( + x +); + +SELECT + Median(a.x), + Median(b.y) +FROM ( + SELECT + 1 AS x +) AS a +JOIN ( + SELECT + 10 AS y +) AS b +ON + a.x == (b.y / 10) +; + +SELECT + Median(a.x), + Median(b.x) +FROM ( + SELECT + 1 AS x +) AS a +JOIN ( + SELECT + 10 AS x +) AS b +ON + a.x == (b.x / 10) +; diff --git a/yql/essentials/tests/sql/suites/aggregate/yql-20171.sql b/yql/essentials/tests/sql/suites/aggregate/yql-20171.sql new file mode 100644 index 00000000000..674b6454018 --- /dev/null +++ b/yql/essentials/tests/sql/suites/aggregate/yql-20171.sql @@ -0,0 +1,10 @@ +SELECT Percentile(a.x, 0.50), Percentile(a.x, 0.75), Percentile(a.x, 1.00) +FROM (VALUES (1), (2), (3), (4), (5)) AS a(x); + +SELECT Median(a.x), Median(b.y) +FROM (SELECT 1 AS x) AS a +JOIN (SELECT 10 AS y) AS b ON a.x == (b.y / 10); + +SELECT Median(a.x), Median(b.x) +FROM (SELECT 1 AS x) AS a +JOIN (SELECT 10 AS x) AS b ON a.x == (b.x / 10); |