Skip to content

Commit 63c2943

Browse files
authored
Minor: Add String/Binary aggregate tests (#6962)
1 parent 796f5f5 commit 63c2943

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed

datafusion/core/tests/sqllogictests/test_files/aggregate.slt

+115
Original file line numberDiff line numberDiff line change
@@ -1889,6 +1889,121 @@ drop table t_source;
18891889
statement ok
18901890
drop table t;
18911891

1892+
1893+
# aggregates on strings
1894+
statement ok
1895+
create table t_source
1896+
as values
1897+
('Foo', 1),
1898+
('Bar', 2),
1899+
(null, 2),
1900+
('Baz', 1);
1901+
1902+
statement ok
1903+
create table t as
1904+
select
1905+
arrow_cast(column1, 'Utf8') as utf8,
1906+
arrow_cast(column1, 'LargeUtf8') as largeutf8,
1907+
column2 as tag
1908+
from t_source;
1909+
1910+
# No groupy
1911+
query TTITTI
1912+
SELECT
1913+
min(utf8),
1914+
max(utf8),
1915+
count(utf8),
1916+
min(largeutf8),
1917+
max(largeutf8),
1918+
count(largeutf8)
1919+
FROM t
1920+
----
1921+
Bar Foo 3 Bar Foo 3
1922+
1923+
1924+
# with groupby
1925+
query TTITTI
1926+
SELECT
1927+
min(utf8),
1928+
max(utf8),
1929+
count(utf8),
1930+
min(largeutf8),
1931+
max(largeutf8),
1932+
count(largeutf8)
1933+
FROM t
1934+
GROUP BY tag
1935+
ORDER BY tag
1936+
----
1937+
Baz Foo 2 Baz Foo 2
1938+
Bar Bar 1 Bar Bar 1
1939+
1940+
1941+
statement ok
1942+
drop table t_source;
1943+
1944+
statement ok
1945+
drop table t;
1946+
1947+
1948+
# aggregates on binary
1949+
statement ok
1950+
create table t_source
1951+
as values
1952+
('Foo', 1),
1953+
('Bar', 2),
1954+
(null, 2),
1955+
('Baz', 1);
1956+
1957+
statement ok
1958+
create table t as
1959+
select
1960+
arrow_cast(column1, 'Binary') as binary,
1961+
arrow_cast(column1, 'LargeBinary') as largebinary,
1962+
column2 as tag
1963+
from t_source;
1964+
1965+
# No groupy
1966+
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
1967+
SELECT
1968+
min(binary),
1969+
max(binary),
1970+
count(binary),
1971+
min(largebinary),
1972+
max(largebinary),
1973+
count(largebinary)
1974+
FROM t
1975+
1976+
1977+
# with groupby
1978+
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
1979+
SELECT
1980+
min(binary),
1981+
max(binary),
1982+
count(binary),
1983+
min(largebinary),
1984+
max(largebinary),
1985+
count(largebinary)
1986+
FROM t
1987+
GROUP BY tag
1988+
ORDER BY tag
1989+
1990+
1991+
1992+
statement ok
1993+
drop table t_source;
1994+
1995+
statement ok
1996+
drop table t;
1997+
1998+
1999+
2000+
2001+
statement error DataFusion error: Execution error: Table 't_source' doesn't exist\.
2002+
drop table t_source;
2003+
2004+
statement error DataFusion error: Execution error: Table 't' doesn't exist\.
2005+
drop table t;
2006+
18922007
query I
18932008
select median(a) from (select 1 as a where 1=0);
18942009
----

0 commit comments

Comments
 (0)