Skip to content

Commit

Permalink
test(grouping-sets): add empty table grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Jan 2, 2025
1 parent 7e49aff commit 418401f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ibis/backends/tests/test_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1779,3 +1779,16 @@ def test_rollup(con, backend, grouping_set_table):
)

backend.assert_frame_equal(result, expected)


def test_grouping_empty_table(con, backend):
# TODO(cpcloud): group_id doesn't allow string columns
t = ibis.memtable({"c1": []}, schema={"c1": "int"})
expr = (
t.group_by(ibis.cube("c1"))
.agg(gid=lambda t: ibis.group_id(t.c1))
.order_by(s.first())
)
result = con.to_pandas(expr)
expected = pd.DataFrame({"c1": [None], "gid": [1]})
backend.assert_frame_equal(result, expected)

0 comments on commit 418401f

Please sign in to comment.