Skip to content

Commit

Permalink
Add tests for decimal count distinct
Browse files Browse the repository at this point in the history
  • Loading branch information
joroKr21 committed Apr 11, 2024
1 parent cb59fbd commit 8e7d302
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions datafusion/sqllogictest/test_files/aggregate.slt
Original file line number Diff line number Diff line change
Expand Up @@ -2300,6 +2300,18 @@ select c2, avg(c1), arrow_typeof(avg(c1)) from d_table GROUP BY c2 ORDER BY c2
A 110.0045 Decimal128(14, 7)
B -100.0045 Decimal128(14, 7)

# aggregate_decimal_count_distinct
query I
select count(DISTINCT c1) from d_table
----
20

query TI
select c2, count(DISTINCT c1) from d_table GROUP BY c2 ORDER BY c2
----
A 10
B 10

# Use PostgresSQL dialect
statement ok
set datafusion.sql_parser.dialect = 'Postgres';
Expand Down
11 changes: 11 additions & 0 deletions datafusion/sqllogictest/test_files/decimal.slt
Original file line number Diff line number Diff line change
Expand Up @@ -720,5 +720,16 @@ select count(*),c1 from decimal256_simple group by c1 order by c1;
4 0.00004
5 0.00005

query I
select count(DISTINCT c1) from decimal256_simple;
----
5

query BI
select c4, count(DISTINCT c1) from decimal256_simple GROUP BY c4 ORDER BY c4;
----
false 4
true 5

statement ok
drop table decimal256_simple;

0 comments on commit 8e7d302

Please sign in to comment.