fix: shape the value buffer for coordinate selections in sharded writes - #4284
fix: shape the value buffer for coordinate selections in sharded writes#4284dylanpulver wants to merge 4 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4284 +/- ##
=======================================
Coverage 94.12% 94.12%
=======================================
Files 92 92
Lines 12831 12839 +8
=======================================
+ Hits 12077 12085 +8
Misses 754 754
🚀 New features to boost your workflow:
|
|
🤖 AI text below 🤖 Code reviewFound 1 issue:
Missing-fix location: zarr-python/src/zarr/codecs/sharding.py Lines 798 to 806 in 01aac1f The reshape added on the async side: zarr-python/src/zarr/codecs/sharding.py Lines 1361 to 1374 in 01aac1f Sync decode twin already carrying the mirrored reshape: zarr-python/src/zarr/codecs/sharding.py Lines 1306 to 1309 in 01aac1f 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
_encode_partial_sync derives its indexer the same way as _encode_partial_single and so hits the same coordinate-selection shape mismatch under FusedCodecPipeline. The regression test is parametrized over both pipelines.
|
Good catch, that was a real gap. Same reshape applied there, and the regression test is now parametrized over both pipelines. All four partial paths handle I confirmed the two Fused variants fail on the previous commit and pass on this one, so the parametrization is doing work rather than duplicating a passing case.
|
Summary
Nightly
Slow Hypothesis CIon main filed #4280 on 2026-08-22 and hit it again on 2026-08-25 (run 32792180919):ValueError: shape mismatch: value array of shape (3,1) could not be broadcast to indexing result of shape (3,). An orthogonal set on a sharded array with two array-indexed dimensions reproduces it:OrthogonalIndexerhands such a chunk selection down as annp.ix_pair (indexing.py:989).get_indexerreads it back as a coordinate selection, whose projections addressshard_arrayflat while the caller shaped it likesel_shape._decode_partial_singlereshapesouttosel_shapeon the way out (sharding.py:1085); this does the same on the way in. Reads were unaffected.For reviewers
Guarded on
shard_array.shape == sel_shape, so a flat value passes through. Checked against a numpynp.ix_oracle over 1568 combinations of chunk grid, sharding nesting, per-dimension selector: 96 failures on main, 0 after, every one a write with two array-indexed dimensions.Author attestation
TODO
changes/