Skip to content

Commit

Permalink
refactor(polars): go through internal APIs instead of custom handling…
Browse files Browse the repository at this point in the history
… for pyarrow conversion
  • Loading branch information
cpcloud committed Sep 2, 2024
1 parent 86787ba commit bfb64ad
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ibis/backends/polars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,15 +519,12 @@ def _to_pyarrow_table(
streaming: bool = False,
**kwargs: Any,
):
from ibis.formats.pyarrow import PyArrowData

df = self._to_dataframe(
expr, params=params, limit=limit, streaming=streaming, **kwargs
)
table = df.to_arrow()
if isinstance(expr, (ir.Table, ir.Value)):
schema = expr.as_table().schema().to_pyarrow()
return table.rename_columns(schema.names).cast(schema)
else:
raise com.IbisError(f"Cannot execute expression of type: {type(expr)}")
return PyArrowData.convert_table(df.to_arrow(), expr.as_table().schema())

def to_pyarrow(
self,
Expand Down

0 comments on commit bfb64ad

Please sign in to comment.