Skip to content

CI: Unpin pyarrow<10 #50314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-conda/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ runs:
- name: Set Arrow version in ${{ inputs.environment-file }} to ${{ inputs.pyarrow-version }}
run: |
grep -q ' - pyarrow' ${{ inputs.environment-file }}
sed -i"" -e "s/ - pyarrow<10/ - pyarrow=${{ inputs.pyarrow-version }}/" ${{ inputs.environment-file }}
sed -i"" -e "s/ - pyarrow/ - pyarrow=${{ inputs.pyarrow-version }}/" ${{ inputs.environment-file }}
cat ${{ inputs.environment-file }}
shell: bash
if: ${{ inputs.pyarrow-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
matrix:
env_file: [actions-38.yaml, actions-39.yaml, actions-310.yaml]
pattern: ["not single_cpu", "single_cpu"]
pyarrow_version: ["7", "8", "9"]
pyarrow_version: ["7", "8", "9", "10"]
include:
- name: "Downstream Compat"
env_file: actions-38-downstream_compat.yaml
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies:
- psycopg2
- pymysql
- pytables
- pyarrow<10
- pyarrow
- pyreadstat
- python-snappy
- pyxlsb
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-38-downstream_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies:
- openpyxl
- odfpy
- psycopg2
- pyarrow<10
- pyarrow
- pymysql
- pyreadstat
- pytables
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-38.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies:
- odfpy
- pandas-gbq
- psycopg2
- pyarrow<10
- pyarrow
- pymysql
- pyreadstat
- pytables
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies:
- pandas-gbq
- psycopg2
- pymysql
- pyarrow<10
- pyarrow
- pyreadstat
- pytables
- python-snappy
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/circle-38-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies:
- odfpy
- pandas-gbq
- psycopg2
- pyarrow<10
- pyarrow
- pymysql
# Not provided on ARM
#- pyreadstat
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies:
- odfpy
- py
- psycopg2
- pyarrow<10
- pyarrow
- pymysql
- pyreadstat
- pytables
Expand Down
2 changes: 2 additions & 0 deletions pandas/compat/pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
pa_version_under7p0 = _palv < Version("7.0.0")
pa_version_under8p0 = _palv < Version("8.0.0")
pa_version_under9p0 = _palv < Version("9.0.0")
pa_version_under10p0 = _palv < Version("10.0.0")
except ImportError:
pa_version_under6p0 = True
pa_version_under7p0 = True
pa_version_under8p0 = True
pa_version_under9p0 = True
pa_version_under10p0 = True
2 changes: 1 addition & 1 deletion pandas/tests/arrays/interval/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def test_arrow_array():
with pytest.raises(TypeError, match="Not supported to convert IntervalArray"):
pa.array(intervals, type="float64")

with pytest.raises(TypeError, match="different 'subtype'"):
with pytest.raises(TypeError, match="different 'subtype'|to convert IntervalArray"):
pa.array(intervals, type=ArrowIntervalType(pa.float64(), "left"))


Expand Down
10 changes: 8 additions & 2 deletions pandas/tests/arrays/period/test_arrow_compat.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest

from pandas.compat.pyarrow import pa_version_under10p0

from pandas.core.dtypes.dtypes import PeriodDtype

import pandas as pd
Expand Down Expand Up @@ -52,8 +54,12 @@ def test_arrow_array(data, freq):
with pytest.raises(TypeError, match=msg):
pa.array(periods, type="float64")

with pytest.raises(TypeError, match="different 'freq'"):
pa.array(periods, type=ArrowPeriodType("T"))
if pa_version_under10p0:
with pytest.raises(TypeError, match="different 'freq'"):
pa.array(periods, type=ArrowPeriodType("T"))
else:
result = pa.array(periods, type=ArrowPeriodType("T"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know why this started working?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, no

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it's probably better if someone familiar with pyarrow reviews this. I don't see why a Int64array is returned after passing type ArrowPeriodType, nor why the freq doesn't seem to make a difference

(Pdb) pa.array(periods, type=ArrowPeriodType("T"))
<pyarrow.lib.Int64Array object at 0x7fb99f3aab80>
[
  17167,
  17168,
  17169
]
(Pdb) pa.array(periods, type=ArrowPeriodType("M"))
<pyarrow.lib.Int64Array object at 0x7fb99f3aaa60>
[
  17167,
  17168,
  17169
]
(Pdb) pa.array(periods, type=ArrowPeriodType("fdafsdfas"))
<pyarrow.lib.Int64Array object at 0x7fb99f3aaa00>
[
  17167,
  17168,
  17169
]

but it's probably my lack of familiarity

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think would still expect this to fail if converting to another freq used to fail cc @jorisvandenbossche

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that seems an oversight in a recent improvement to allow specifying extension types in pa.array(..) (so specifically when passing objects that define __arrow_array__, we ignore the user specified type ..).

(sidenote: we should really try to catch such issues before releasing .. We never tested against the nightly conda/wheel package of pyarrow?)

About failing to cast: I am not sure that is possible / easy (without adding some mechanism to let the extension type control the cast behaviour). How it works right now (once fixed) is that the input is first cast to the extension type's storage type (in this case int64), and then the extension array is constructor from that storage.
Which doesn't make sense here in the case of two different period freqs, so that's clearly a sign we need to make this "smarter" somehow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation. Marked test as xfail for now

assert result.equals(expected)


def test_arrow_array_missing():
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ openpyxl
odfpy
py
psycopg2-binary
pyarrow<10
pyarrow
pymysql
pyreadstat
tables
Expand Down