Skip to content

Commit 418401f

Browse files
committed
test(grouping-sets): add empty table grouping
1 parent 7e49aff commit 418401f

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
@@ -1779,3 +1779,16 @@ def test_rollup(con, backend, grouping_set_table):
17791779
)
17801780

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

0 commit comments

Comments
 (0)