Skip to content

Commit 66d6839

Browse files
committed
test(grouping-sets): add empty table grouping
1 parent 4d873f5 commit 66d6839

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ibis/backends/tests/test_aggregation.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,3 +1780,16 @@ def test_rollup(con, backend, grouping_set_table):
17801780
)
17811781

17821782
backend.assert_frame_equal(result, expected)
1783+
1784+
1785+
def test_grouping_empty_table(con, backend):
1786+
# TODO(cpcloud): group_id doesn't allow string columns
1787+
t = ibis.memtable({"c1": []}, schema={"c1": "int"})
1788+
expr = (
1789+
t.group_by(ibis.cube("c1"))
1790+
.agg(gid=lambda t: ibis.group_id(t.c1))
1791+
.order_by(s.first())
1792+
)
1793+
result = con.to_pandas(expr)
1794+
expected = pd.DataFrame({"c1": [None], "gid": [1]})
1795+
backend.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)