Skip to content

Commit

Permalink
test(polars): add failing flatten test
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Sep 19, 2024
1 parent 54472b4 commit d91c3b2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ibis/backends/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,11 @@ def flatten_data():
reason="Arrays are never nullable",
raises=AssertionError,
),
pytest.mark.notyet(
["polars"],
reason="flattened empty arrays incorrectly insert a null",
raises=AssertionError,
),
],
),
],
Expand Down Expand Up @@ -1557,3 +1562,13 @@ def test_array_agg_bool(con, data, agg, baseline_func):
result = [x if pd.notna(x) else None for x in result]
expected = [baseline_func(x) for x in df.x]
assert result == expected


def test_flatten(con):
t = ibis.memtable(
[{"arr": [[1, 5, 7], [3, 4]]}], schema={"arr": "array<array<int64>>"}
)
expr = t.arr.flatten().name("result")
result = con.execute(expr)
expected = pd.Series([[1, 5, 7, 3, 4]], name="result")
tm.assert_series_equal(result, expected)

0 comments on commit d91c3b2

Please sign in to comment.