1
1
from __future__ import annotations
2
2
3
3
import itertools
4
+ import sqlite3
4
5
from datetime import date
5
6
from operator import methodcaller
6
7
20
21
GoogleBadRequest ,
21
22
ImpalaHiveServer2Error ,
22
23
MySQLNotSupportedError ,
24
+ MySQLOperationalError ,
23
25
OracleDatabaseError ,
26
+ PolarsColumnNotFoundError ,
24
27
PolarsInvalidOperationError ,
25
28
PsycoPg2InternalError ,
26
29
Py4JError ,
@@ -1750,6 +1753,10 @@ def grouping_set_table():
1750
1753
)
1751
1754
1752
1755
1756
+ @pytest .mark .notyet (["sqlite" ], raises = sqlite3 .OperationalError )
1757
+ @pytest .mark .notyet (["mysql" ], raises = MySQLOperationalError )
1758
+ @pytest .mark .notyet (["polars" ], raises = PolarsColumnNotFoundError )
1759
+ @pytest .mark .notyet (["druid" ])
1753
1760
def test_cube (con , backend , grouping_set_table ):
1754
1761
expr = (
1755
1762
grouping_set_table .group_by (ibis .cube ("b" ))
@@ -1763,6 +1770,10 @@ def test_cube(con, backend, grouping_set_table):
1763
1770
backend .assert_frame_equal (result , expected )
1764
1771
1765
1772
1773
+ @pytest .mark .notyet (["sqlite" ], raises = sqlite3 .OperationalError )
1774
+ @pytest .mark .notyet (["mysql" ], raises = MySQLOperationalError )
1775
+ @pytest .mark .notyet (["polars" ], raises = PolarsColumnNotFoundError )
1776
+ @pytest .mark .notyet (["druid" ])
1766
1777
def test_rollup (con , backend , grouping_set_table ):
1767
1778
expr = (
1768
1779
grouping_set_table .group_by (ibis .rollup ("b" , "c" ))
@@ -1782,6 +1793,26 @@ def test_rollup(con, backend, grouping_set_table):
1782
1793
backend .assert_frame_equal (result , expected )
1783
1794
1784
1795
1796
+ @pytest .mark .notyet (["sqlite" ], raises = sqlite3 .OperationalError )
1797
+ @pytest .mark .notyet (["mysql" ], raises = MySQLOperationalError )
1798
+ @pytest .mark .notimpl (["polars" ], raises = com .OperationNotDefinedError )
1799
+ @pytest .mark .notyet (["druid" ], raises = Exception )
1800
+ @pytest .mark .notyet (
1801
+ [
1802
+ "exasol" ,
1803
+ "oracle" ,
1804
+ "clickhouse" ,
1805
+ "datafusion" ,
1806
+ "risingwave" ,
1807
+ "mssql" ,
1808
+ "pyspark" ,
1809
+ "impala" ,
1810
+ "snowflake" ,
1811
+ "bigquery" ,
1812
+ ],
1813
+ raises = AssertionError ,
1814
+ reason = "returns empty for a grouping set on an empty table, which disagrees with half the backends" ,
1815
+ )
1785
1816
def test_grouping_empty_table (con , backend ):
1786
1817
# TODO(cpcloud): group_id doesn't allow string columns
1787
1818
t = ibis .memtable ({"c1" : []}, schema = {"c1" : "int" })
@@ -1791,5 +1822,8 @@ def test_grouping_empty_table(con, backend):
1791
1822
.order_by (s .first ())
1792
1823
)
1793
1824
result = con .to_pandas (expr )
1794
- expected = pd .DataFrame ({"c1" : [None ], "gid" : [1 ]})
1795
- backend .assert_frame_equal (result , expected )
1825
+
1826
+ assert len (result ) == 1
1827
+ assert len (result .columns ) == 2
1828
+ assert pd .isnull (result .at [0 , "c1" ])
1829
+ assert result .at [0 , "gid" ] == 1
0 commit comments