Skip to content

Commit 87c19a5

Browse files
committed
Add tests for hash/sort based aggregation paths
1 parent f8f1ebb commit 87c19a5

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

sql/core/src/test/resources/sql-tests/inputs/group-by.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,11 @@ select int_col, count(*) from myview group by int_col;
77
-- group by should produce a single row.
88
select 'foo', count(*) from myview group by 1;
99

10-
-- group-by should not produce any rows.
10+
-- group-by should not produce any rows (whole stage code generation).
1111
select 'foo' from myview where int_col == 0 group by 1;
12+
13+
-- group-by should not produce any rows (hash aggregate).
14+
select 'foo', approx_count_distinct(int_col) from myview where int_col == 0 group by 1;
15+
16+
-- group-by should not produce any rows (sort aggregate).
17+
select 'foo', max(struct(int_col)) from myview where int_col == 0 group by 1;

sql/core/src/test/resources/sql-tests/results/group-by.sql.out

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- Automatically generated by SQLQueryTestSuite
2-
-- Number of queries: 4
2+
-- Number of queries: 6
33

44

55
-- !query 0
@@ -33,3 +33,19 @@ select 'foo' from myview where int_col == 0 group by 1
3333
struct<foo:string>
3434
-- !query 3 output
3535

36+
37+
38+
-- !query 4
39+
select 'foo', approx_count_distinct(int_col) from myview where int_col == 0 group by 1
40+
-- !query 4 schema
41+
struct<foo:string,approx_count_distinct(int_col):bigint>
42+
-- !query 4 output
43+
44+
45+
46+
-- !query 5
47+
select 'foo', max(struct(int_col)) from myview where int_col == 0 group by 1
48+
-- !query 5 schema
49+
struct<foo:string,max(struct(int_col)):struct<int_col:int>>
50+
-- !query 5 output
51+

0 commit comments

Comments
 (0)