Skip to content

Commit

Permalink
fix(polars): handle pl.Array (#10260)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored Oct 6, 2024
1 parent 0a86e3c commit aadae58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ibis/formats/polars.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def to_ibis(cls, typ: pl.DataType, nullable=True) -> dt.DataType:
except AttributeError: # pragma: no cover
time_unit = typ.tu # pragma: no cover
return dt.Interval(unit=time_unit, nullable=nullable)
elif base_type is pl.List:
elif base_type is pl.List or base_type is pl.Array:
return dt.Array(cls.to_ibis(typ.inner), nullable=nullable)
elif base_type is pl.Struct:
return dt.Struct.from_tuples(
Expand Down
4 changes: 4 additions & 0 deletions ibis/formats/tests/test_polars.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,7 @@ def test_convert_table():
)
assert df.equals(sol)
assert df.schema == sol.schema


def test_array_type():
assert PolarsType.to_ibis(pl.Array(pl.Int64, 2)) == dt.Array(dt.int64)

0 comments on commit aadae58

Please sign in to comment.