Skip to content

fix: require pyarrow>=17.0.0#4152

Merged
ianna merged 3 commits into
mainfrom
henryiii/require-pyarrow-17
Jun 24, 2026
Merged

fix: require pyarrow>=17.0.0#4152
ianna merged 3 commits into
mainfrom
henryiii/require-pyarrow-17

Conversation

@henryiii

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Fixes #4151.

What

Raise the supported pyarrow floor to 17.0.0 (runtime guard in _connect/pyarrow/__init__.py, plus requirements-test-{minimal,full,nogil}.txt).

Why

tests/test_2616_use_pyarrow_for_strings.py::test_split_whitespace flaked on the minimal CI job (Python 3.10, pyarrow==14.0.0), mis-splitting " abc " as ['', 'abc', ' '] instead of ['', 'abc', '', ''].

Root cause is an upstream pyarrow kernel over-read: utf8_split_whitespace (SplitWhitespaceUtf8Finder::Findarrow::util::UTF8Decode) reads one byte past the end of the input values buffer. Awkward's to_arrow hands pyarrow exactly-sized, zero-copy numpy buffers (not 64-byte padded as Arrow recommends), so the over-read lands in adjacent heap memory rather than zero padding. When that byte is non-whitespace, the trailing whitespace run is mis-split — a rare, memory-state-dependent flake (and a genuine correctness bug for any user on pyarrow 12–16).

Confirmed with MALLOC_PERTURB_=255 + allocator churn (deterministic reproduction) and valgrind (Invalid read of size 1 at UTF8Decode … StringSplitExec<LargeStringType,…>, "0 bytes after a block of size 86" — awkward's input char buffer). Bisected: wrong on 14.0.0 / 15.0.2 / 16.1.0, fixed in 17.0.0+.

Notes

AI-assisted (Claude Code): diagnosis and this change.

pyarrow's utf8/ascii_split_whitespace kernel reads one byte past the end
of the input values buffer (SplitWhitespaceUtf8Finder::Find -> UTF8Decode).
Awkward's to_arrow hands pyarrow exactly-sized, zero-copy numpy buffers
(not 64-byte padded as Arrow recommends), so the over-read lands in
adjacent heap memory instead of zero padding. When that byte is
non-whitespace, trailing whitespace is mis-split, e.g.
"      abc      " -> ['', 'abc', ' '] instead of ['', 'abc', '', ''].

This surfaced as a rare flake in test_split_whitespace on the minimal CI
job (pyarrow==14.0.0). Confirmed via MALLOC_PERTURB_ + valgrind, and
bisected: wrong on 14/15/16, fixed upstream in Arrow 17.0.0.

Raise the runtime floor and test requirements to 17.0.0.

Assisted-by: ClaudeCode:claude-opus-4.8
@github-actions github-actions Bot added the type/fix PR title type: fix (set automatically) label Jun 23, 2026
Follow-ups to requiring pyarrow>=17.0.0: the skipif in
test_2650_arrow_array_highlevel can never trigger now, and docs
requirements still pinned the old >=7.0.0 floor.

Assisted-by: ClaudeCode:claude-opus-4.8
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.43%. Comparing base (e562201) to head (8f1e5a4).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/awkward/_connect/pyarrow/__init__.py 50.00% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/awkward/_connect/pyarrow/__init__.py 46.00% <50.00%> (ø)

@ianna ianna left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@henryiii - Thanks for providing the fix so quickly! If you are done with it please merge it. Thanks!

@ianna
ianna enabled auto-merge (squash) June 24, 2026 08:19
@ianna
ianna merged commit 29e4618 into main Jun 24, 2026
37 of 38 checks passed
@ianna
ianna deleted the henryiii/require-pyarrow-17 branch June 24, 2026 08:43
@ikrommyd

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/fix PR title type: fix (set automatically)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test_split_whitespace: pyarrow <17 over-reads unpadded buffers from to_arrow

4 participants