Skip to content

Commit 3d518f6

Browse files
authored
YQ-3617: fix GROUP BY HOP + AS_TABLE (#9027)
1 parent 5f125c0 commit 3d518f6

File tree

4 files changed

+59
-1
lines changed

4 files changed

+59
-1
lines changed

ydb/library/yql/core/yql_aggregate_expander.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ TExprNode::TPtr TAggregateExpander::ExpandAggregateWithFullOutput()
3232
auto settings = Node->Child(3);
3333

3434
bool allTraitsCollected = CollectTraits();
35-
YQL_ENSURE(!HasSetting(*settings, "hopping"), "Aggregate with hopping unsupported here.");
35+
// YQL_ENSURE(!HasSetting(*settings, "hopping"), "Aggregate with hopping unsupported here."); // TODO(YQ-3661): uncomment
3636

3737
HaveDistinct = AnyOf(AggregatedColumns->ChildrenList(),
3838
[](const auto& child) { return child->ChildrenSize() == 3; });

ydb/library/yql/tests/sql/dq_file/part4/canondata/result.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,34 @@
362362
"uri": "https://{canondata_backend}/1899731/d439cec3e297e3dd031f751fd90f3935129a1094/resource.tar.gz#test.test_aggregate-group_by_hop--Results_/results.txt"
363363
}
364364
],
365+
"test.test[aggregate-group_by_hop_small-default.txt-Analyze]": [
366+
{
367+
"checksum": "b4dd508a329723c74293d80f0278c705",
368+
"size": 505,
369+
"uri": "https://{canondata_backend}/1847551/2209c2969854610c404ebe58fe3bfaa092239305/resource.tar.gz#test.test_aggregate-group_by_hop_small-default.txt-Analyze_/plan.txt"
370+
}
371+
],
372+
"test.test[aggregate-group_by_hop_small-default.txt-Debug]": [
373+
{
374+
"checksum": "4eb73aa6ee121bbad859125d3cfd5a95",
375+
"size": 1015,
376+
"uri": "https://{canondata_backend}/1847551/2209c2969854610c404ebe58fe3bfaa092239305/resource.tar.gz#test.test_aggregate-group_by_hop_small-default.txt-Debug_/opt.yql_patched"
377+
}
378+
],
379+
"test.test[aggregate-group_by_hop_small-default.txt-Plan]": [
380+
{
381+
"checksum": "b4dd508a329723c74293d80f0278c705",
382+
"size": 505,
383+
"uri": "https://{canondata_backend}/1847551/2209c2969854610c404ebe58fe3bfaa092239305/resource.tar.gz#test.test_aggregate-group_by_hop_small-default.txt-Plan_/plan.txt"
384+
}
385+
],
386+
"test.test[aggregate-group_by_hop_small-default.txt-Results]": [
387+
{
388+
"checksum": "b204692654e9a175f23dc8efd761e05b",
389+
"size": 696,
390+
"uri": "https://{canondata_backend}/1847551/2209c2969854610c404ebe58fe3bfaa092239305/resource.tar.gz#test.test_aggregate-group_by_hop_small-default.txt-Results_/results.txt"
391+
}
392+
],
365393
"test.test[aggregate-group_by_hop_star--Analyze]": [
366394
{
367395
"checksum": "9221cc272d85bbacaaea3595e69b6b17",

ydb/library/yql/tests/sql/sql2yql/canondata/result.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,13 @@
21832183
"uri": "https://{canondata_backend}/1784117/d56ae82ad9d30397a41490647be1bd2124718f98/resource.tar.gz#test_sql2yql.test_aggregate-group_by_hop_only_start_/sql.yql"
21842184
}
21852185
],
2186+
"test_sql2yql.test[aggregate-group_by_hop_small]": [
2187+
{
2188+
"checksum": "91dd52bcee5be9d4f5f9638eb801db32",
2189+
"size": 2149,
2190+
"uri": "https://{canondata_backend}/1920236/bb2301e85eb73fecf6260a9c1294520fbf1e952e/resource.tar.gz#test_sql2yql.test_aggregate-group_by_hop_small_/sql.yql"
2191+
}
2192+
],
21862193
"test_sql2yql.test[aggregate-group_by_hop_star]": [
21872194
{
21882195
"checksum": "e777f280db84a47b4cdfe9176e6d9d1f",
@@ -21804,6 +21811,13 @@
2180421811
"uri": "https://{canondata_backend}/1880306/64654158d6bfb1289c66c626a8162239289559d0/resource.tar.gz#test_sql_format.test_aggregate-group_by_hop_only_start_/formatted.sql"
2180521812
}
2180621813
],
21814+
"test_sql_format.test[aggregate-group_by_hop_small]": [
21815+
{
21816+
"checksum": "27fdd7af224a36c15155f7f69f14ad07",
21817+
"size": 393,
21818+
"uri": "https://{canondata_backend}/1942173/9d793e788c391df831fae057e65f63b2b147c4d4/resource.tar.gz#test_sql_format.test_aggregate-group_by_hop_small_/formatted.sql"
21819+
}
21820+
],
2180721821
"test_sql_format.test[aggregate-group_by_hop_star]": [
2180821822
{
2180921823
"checksum": "0132a85abf9d40c5a848a3c031206631",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* syntax version 1 */
2+
/* postgres can not */
3+
/* ytfile can not */
4+
/* yt can not */
5+
6+
$input = SELECT * FROM AS_TABLE([
7+
<|"time":"2024-01-01T00:00:01Z"|>,
8+
<|"time":"2024-01-02T00:00:01Z"|>,
9+
<|"time":"2024-01-03T00:00:01Z"|>
10+
]);
11+
12+
SELECT
13+
COUNT(*),
14+
-- HOP_START()
15+
FROM $input
16+
GROUP BY HOP(CAST(time as Timestamp), 'PT60S', 'PT86400S', 'PT60S')

0 commit comments

Comments
 (0)