Skip to content

Commit

Permalink
added count aggregate slt (#13790)
Browse files Browse the repository at this point in the history
  • Loading branch information
buraksenn authored Dec 16, 2024
1 parent 2176330 commit 5c29399
Showing 1 changed file with 54 additions and 3 deletions.
57 changes: 54 additions & 3 deletions datafusion/sqllogictest/test_files/aggregate.slt
Original file line number Diff line number Diff line change
Expand Up @@ -2179,11 +2179,62 @@ SELECT COUNT(c1), COUNT(c2) FROM test
----
4 4

# TODO: count_partitioned

# TODO: count_aggregated
statement ok
CREATE EXTERNAL TABLE partitioned_test (c1 int, c2 bigint, c3 boolean)
STORED AS CSV LOCATION '../core/tests/data/partitioned_csv'
OPTIONS('format.has_header' 'false');

# count partitioned
query II
SELECT COUNT(c1), COUNT(c2) FROM partitioned_test
----
44 44

# count partitioned with multiple columns
query I
SELECT COUNT(c1,c2) FROM partitioned_test
----
44

statement ok
DROP TABLE partitioned_test;

# TODO: count_aggregated_cube

# count aggregated
query II
SELECT c1, count(c2) FROM test WHERE c1 IS NOT NULL group by c1 order by c1
----
0 0
1 1
3 2

statement ok
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);

# count aggregated cube
query III
SELECT c1, c2, count(c3) FROM table_agg_cube GROUP BY CUBE (c1, c2) ORDER BY c1, c2
----
1 1 1
1 2 1
1 3 1
1 NULL 3
2 1 1
2 2 1
2 3 1
2 NULL 3
3 1 1
3 2 1
3 3 1
3 NULL 3
NULL 1 3
NULL 2 3
NULL 3 3
NULL NULL 9

statement ok
drop table table_agg_cube;

# count_multi_expr
query I
Expand Down

0 comments on commit 5c29399

Please sign in to comment.