Skip to content

Commit 5c29399

Browse files
authored
added count aggregate slt (#13790)
1 parent 2176330 commit 5c29399

File tree

1 file changed

+54
-3
lines changed

1 file changed

+54
-3
lines changed

datafusion/sqllogictest/test_files/aggregate.slt

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,11 +2179,62 @@ SELECT COUNT(c1), COUNT(c2) FROM test
21792179
----
21802180
4 4
21812181

2182-
# TODO: count_partitioned
21832182

2184-
# TODO: count_aggregated
2183+
statement ok
2184+
CREATE EXTERNAL TABLE partitioned_test (c1 int, c2 bigint, c3 boolean)
2185+
STORED AS CSV LOCATION '../core/tests/data/partitioned_csv'
2186+
OPTIONS('format.has_header' 'false');
2187+
2188+
# count partitioned
2189+
query II
2190+
SELECT COUNT(c1), COUNT(c2) FROM partitioned_test
2191+
----
2192+
44 44
2193+
2194+
# count partitioned with multiple columns
2195+
query I
2196+
SELECT COUNT(c1,c2) FROM partitioned_test
2197+
----
2198+
44
2199+
2200+
statement ok
2201+
DROP TABLE partitioned_test;
21852202

2186-
# TODO: count_aggregated_cube
2203+
2204+
# count aggregated
2205+
query II
2206+
SELECT c1, count(c2) FROM test WHERE c1 IS NOT NULL group by c1 order by c1
2207+
----
2208+
0 0
2209+
1 1
2210+
3 2
2211+
2212+
statement ok
2213+
create table table_agg_cube (c1 int, c2 int, c3 int) as values (1, 1, 1), (1, 2, 2), (1, 3, 3), (2, 1, 1), (2, 2, 2), (2, 3, 3), (3, 1, 1), (3, 2, 2), (3, 3, 3);
2214+
2215+
# count aggregated cube
2216+
query III
2217+
SELECT c1, c2, count(c3) FROM table_agg_cube GROUP BY CUBE (c1, c2) ORDER BY c1, c2
2218+
----
2219+
1 1 1
2220+
1 2 1
2221+
1 3 1
2222+
1 NULL 3
2223+
2 1 1
2224+
2 2 1
2225+
2 3 1
2226+
2 NULL 3
2227+
3 1 1
2228+
3 2 1
2229+
3 3 1
2230+
3 NULL 3
2231+
NULL 1 3
2232+
NULL 2 3
2233+
NULL 3 3
2234+
NULL NULL 9
2235+
2236+
statement ok
2237+
drop table table_agg_cube;
21872238

21882239
# count_multi_expr
21892240
query I

0 commit comments

Comments
 (0)