Skip to content

[SPARK-58115][PYTHON][TEST] Handle Pandas 3 in PyArrow Array.to_pandas golden test#57237

Open
zhengruifeng wants to merge 3 commits into
apache:masterfrom
zhengruifeng:python/pandas3-pyarrow-golden-dev3
Open

[SPARK-58115][PYTHON][TEST] Handle Pandas 3 in PyArrow Array.to_pandas golden test#57237
zhengruifeng wants to merge 3 commits into
apache:masterfrom
zhengruifeng:python/pandas3-pyarrow-golden-dev3

Conversation

@zhengruifeng

@zhengruifeng zhengruifeng commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Keep the existing PyArrow Array.to_pandas() golden files unchanged and patch the expected string conversion results in memory when running with pandas 3. PyArrow 24-specific overrides cover empty string arrays, whose conversion changed separately from non-empty arrays.

Why are the changes needed?

Pandas 3 uses its dedicated string dtype when converting non-empty Arrow string arrays, while PyArrow 24 extends that behavior to empty string arrays. The shared golden expects Series[object], causing the pandas 3 CI job to fail with six mismatches for string and large_string arrays.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

  • pandas 2.3.3 / PyArrow 23.0.1:
    conda run -n spark-dev-313 env PYTHONPATH=python python -m unittest pyspark.tests.upstream.pyarrow.test_pyarrow_arrow_to_pandas_default
  • pandas 3.0.2 / PyArrow 23.0.1:
    conda run -n spark-dev-313-p3 env PYTHONPATH=python python -m unittest pyspark.tests.upstream.pyarrow.test_pyarrow_arrow_to_pandas_default
  • pandas 3.0.3 / PyArrow 24.0.0 / NumPy 2.5.1, matching the failed CI job:
    conda run -n spark-dev-313-p3 env PYTHONPATH=/tmp/spark-pandas3-ci:python python -m unittest pyspark.tests.upstream.pyarrow.test_pyarrow_arrow_to_pandas_default

Was this patch authored or co-authored using generative AI tooling?

Generated-by: OpenAI Codex (GPT-5)

@zhengruifeng zhengruifeng changed the title [PYTHON][TEST] Use pandas-specific PyArrow goldens [PYTHON][TEST] Patch pandas-specific PyArrow goldens in memory Jul 14, 2026
@zhengruifeng zhengruifeng changed the title [PYTHON][TEST] Patch pandas-specific PyArrow goldens in memory [PYTHON][TEST] Handle Pandas 3 in PyArrow Array.to_pandas golden test Jul 14, 2026
@zhengruifeng zhengruifeng changed the title [PYTHON][TEST] Handle Pandas 3 in PyArrow Array.to_pandas golden test [SPARK-58115][PYTHON][TEST] Handle Pandas 3 in PyArrow Array.to_pandas golden test Jul 14, 2026
@zhengruifeng zhengruifeng marked this pull request as ready for review July 14, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant