test: add property-based roundtrip test for to_parquet/from_parquet#4218
Merged
TaiSakuma merged 3 commits intoJul 22, 2026
Merged
Conversation
Generate arrays restricted to what the parquet path can roundtrip: no unions, no unknown types, and dtypes limited to those pyarrow can write and read back unchanged (complex excluded; datetime64 only "ns"; timedelta64 only "s"/"ms"/"us"/"ns"). A `parquet_writable` predicate excludes layouts that `to_arrow`/`from_parquet` currently mishandle, including a silent offsets-shift corruption for nullable var-length lists. Tests write to fsspec's in-memory filesystem, so no disk I/O. A second test covers option-type layouts (returned as bit-masked, so content classes are not compared), and a third checks that `attrs` survive the roundtrip. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 21, 2026
The four defects excluded by `parquet_dtype` and `parquet_writable` are now reported: scikit-hep#4219 (datetime64[D] value corruption), scikit-hep#4220 (row-group statistics OverflowError), scikit-hep#4221 (zero-length-content IndexError), and scikit-hep#4222 (offsets-shift corruption for nullable lists). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Skip when pyarrow is not installed (Windows CI), matching the other parquet tests, and exclude extended-precision floats: hypothesis-awkward builds its dtype list from the platform's NumPy, so Linux generates float128, which pyarrow cannot write. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
|
The documentation preview is ready to be viewed at http://preview.awkward-array.org.s3-website.us-east-1.amazonaws.com/PR4218 |
ianna
approved these changes
Jul 22, 2026
ianna
left a comment
Member
There was a problem hiding this comment.
@TaiSakuma — this is fantastic! More bugs revealed and fixed. Thank you!
This was referenced Jul 22, 2026
This was referenced Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a Hypothesis roundtrip test for
ak.to_parquet/ak.from_parquet, the third member of the roundtrip property-test family aftertest_to_from_buffers.pyand #4215.The tests write to fsspec's in-memory filesystem (
memory://), so no disk I/O is involved; an example takes about 1 ms. Three tests:test_roundtripgenerates arrays without option types and asserts strictak.array_equalafter the roundtrip.test_roundtrip_maskedenables option types and compares withsame_content_types=False, becausefrom_parquetreturns every option layout asBitMaskedArray(orUnmaskedArray). It setsallow_regular=Falsebecause an option directly over a fixed-size list cannot be written (ARROW-14547).test_roundtrip_attrschecks that JSON-compatibleattrssurvive the roundtrip (follow-up coverage for the recent attrs work, #4079/#4209/#4210); keys starting with@are excluded as intentionally transient.Generation is restricted to what the parquet path can represent:
SUPPORTED_PARQUET_DTYPES: complex is excluded (pyarrow cannot write it); datetime64 onlyns(coarser units are unsupported or coerced,Dcorrupts values, andms/uscrashfrom_parquetwhen row-group statistics contain NaT or out-of-range values); timedelta64 onlys/ms/us/ns.allow_union=False(pyarrow cannot write unions to parquet) andallow_empty=False(a bare unknown type cannot be written; a nested one reads back as an option).parquet_writablepredicate excludes layouts that the conversion currently mishandles: zero-field records, size-0RegularArray(write crash),IndexedOptionArrayover zero-length content (write crash), a top-level record whose only field is named""(collides with the anonymous column used for non-record arrays), option-of-record with all-option fields (outermost struct validity is not stored), and nullable var-length lists whose offsets do not start at zero (silent data corruption: every list is shifted byoffsets[0]). The predicate rejects about 6% of generated examples.Four of these exclusions are pre-existing bugs found by this test during development (the
datetime64[D]value corruption, the row-group-statisticsOverflowError, the zero-length-content write crash, and the offsets-shift corruption). I will file them as separate issues and then update the corresponding comments in this test to cite the issue numbers.Verified: 200 examples per test (default profile, ~4 s), 10,000 examples per test (nightly profile, ~2.5 min), and
pre-commitclean.🤖 Generated with Claude Code