Skip to content

Commit

Permalink
fix(deps): update dependency pyarrow to v17 (#9614)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Phillip Cloud <417981+cpcloud@users.noreply.github.com>
  • Loading branch information
renovate[bot] and cpcloud authored Jul 17, 2024
1 parent 3b2a7ec commit 16998df
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 52 deletions.
1 change: 1 addition & 0 deletions ibis/backends/bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ def to_pyarrow(
table = query.to_arrow(
progress_bar_type=None, bqstorage_client=self.storage_client
)
table = table.rename_columns(list(expr.as_table().schema().names))
return expr.__pyarrow_result__(table)

def to_pyarrow_batches(
Expand Down
39 changes: 27 additions & 12 deletions ibis/backends/tests/test_export.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

from operator import methodcaller

import pandas as pd
import pytest
from packaging.version import parse as vparse
Expand Down Expand Up @@ -545,20 +547,33 @@ def test_table_to_polars(limit, awards_players):


@pytest.mark.parametrize("limit", limit_no_limit)
def test_column_to_polars(limit, awards_players):
pl = pytest.importorskip("polars")
res = awards_players.awardID.to_polars(limit=limit)
assert isinstance(res, pl.Series)
if limit is not None:
assert len(res) == limit
@pytest.mark.parametrize(
("output_format", "expected_column_type"),
[("pyarrow", "ChunkedArray"), ("polars", "Series")],
ids=["pyarrow", "polars"],
)
def test_column_to_memory(limit, awards_players, output_format, expected_column_type):
mod = pytest.importorskip(output_format)
method = methodcaller(f"to_{output_format}", limit=limit)
res = method(awards_players.awardID)
assert isinstance(res, getattr(mod, expected_column_type))
assert (limit is not None and len(res) == limit) or len(
res
) == awards_players.count().execute()


@pytest.mark.parametrize("limit", no_limit)
def test_scalar_to_polars(limit, awards_players):
pytest.importorskip("polars")
scalar = awards_players.yearID.min().to_polars(limit=limit)
assert isinstance(scalar, int)
@pytest.mark.parametrize(
("output_format", "converter"),
[("pyarrow", methodcaller("as_py")), ("polars", lambda x: x)],
ids=["pyarrow", "polars"],
)
def test_scalar_to_memory(limit, awards_players, output_format, converter):
pytest.importorskip(output_format)
method = methodcaller(f"to_{output_format}", limit=limit)
scalar = method(awards_players.yearID.min())
assert isinstance(converter(scalar), int)

expr = awards_players.filter(awards_players.awardID == "DEADBEEF").yearID.min()
res = expr.to_polars(limit=limit)
assert res is None
res = method(expr)
assert converter(res) is None
79 changes: 41 additions & 38 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ atpublic = ">=2.3,<5"
numpy = ">=1.23.2,<3"
pandas = ">=1.5.3,<3"
parsy = ">=2,<3"
pyarrow = { version = ">=10.0.1,<17", optional = true }
pyarrow = { version = ">=10.0.1,<18", optional = true }
pyarrow-hotfix = { version = ">=0.4,<1", optional = true }
python-dateutil = ">=2.8.2,<3"
pytz = ">=2022.7"
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ pure-sasl==0.6.2 ; python_version >= "3.10" and python_version < "4.0"
py-cpuinfo==9.0.0 ; python_version >= "3.10" and python_version < "4.0"
py4j==0.10.9.7 ; python_version >= "3.10" and python_version < "4.0"
pyarrow-hotfix==0.6 ; python_version >= "3.10" and python_version < "4.0"
pyarrow==16.1.0 ; python_version >= "3.10" and python_version < "4.0"
pyarrow==17.0.0 ; python_version >= "3.10" and python_version < "4.0"
pyasn1-modules==0.4.0 ; python_version >= "3.10" and python_version < "4.0"
pyasn1==0.6.0 ; python_version >= "3.10" and python_version < "4"
pycparser==2.22 ; python_version >= "3.10" and python_version < "4.0"
Expand Down

0 comments on commit 16998df

Please sign in to comment.