Skip to content

Minor: Add String/Binary aggregate tests #6962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions datafusion/core/tests/sqllogictests/test_files/aggregate.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1889,6 +1889,121 @@ drop table t_source;
statement ok
drop table t;


# aggregates on strings
statement ok
create table t_source
as values
('Foo', 1),
('Bar', 2),
(null, 2),
('Baz', 1);

statement ok
create table t as
select
arrow_cast(column1, 'Utf8') as utf8,
arrow_cast(column1, 'LargeUtf8') as largeutf8,
column2 as tag
from t_source;

# No groupy
query TTITTI
SELECT
min(utf8),
max(utf8),
count(utf8),
min(largeutf8),
max(largeutf8),
count(largeutf8)
FROM t
----
Bar Foo 3 Bar Foo 3


# with groupby
query TTITTI
SELECT
min(utf8),
max(utf8),
count(utf8),
min(largeutf8),
max(largeutf8),
count(largeutf8)
FROM t
GROUP BY tag
ORDER BY tag
----
Baz Foo 2 Baz Foo 2
Bar Bar 1 Bar Bar 1


statement ok
drop table t_source;

statement ok
drop table t;


# aggregates on binary
statement ok
create table t_source
as values
('Foo', 1),
('Bar', 2),
(null, 2),
('Baz', 1);

statement ok
create table t as
select
arrow_cast(column1, 'Binary') as binary,
arrow_cast(column1, 'LargeBinary') as largebinary,
column2 as tag
from t_source;

# No groupy
query error DataFusion error: Internal error: Min/Max accumulator not implemented for type Binary\. This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
SELECT
min(binary),
max(binary),
count(binary),
min(largebinary),
max(largebinary),
count(largebinary)
FROM t


# with groupby
query error DataFusion error: External error: Internal error: Min/Max accumulator not implemented for type Binary\. This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
SELECT
min(binary),
max(binary),
count(binary),
min(largebinary),
max(largebinary),
count(largebinary)
FROM t
GROUP BY tag
ORDER BY tag



statement ok
drop table t_source;

statement ok
drop table t;




statement error DataFusion error: Execution error: Table 't_source' doesn't exist\.
drop table t_source;

statement error DataFusion error: Execution error: Table 't' doesn't exist\.
drop table t;

query I
select median(a) from (select 1 as a where 1=0);
----
Expand Down