Fix v2 structured field selection#3996
Open
puneetdixit200 wants to merge 2 commits into
Open
Conversation
9632e91 to
e9e8350
Compare
Author
|
Pushed a follow-up for the min-deps CI failure. The failure was caused by package version discovery selecting the auxiliary Additional local checks: |
Contributor
|
hi @puneetdixit200 before you get too deep in to this PR, it might make sense to resolve the points I raised in #3983 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3996 +/- ##
==========================================
+ Coverage 93.39% 93.43% +0.04%
==========================================
Files 88 88
Lines 11839 11843 +4
==========================================
+ Hits 11057 11066 +9
+ Misses 782 777 -5
🚀 New features to boost your workflow:
|
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.
Fixes #3983
This fixes field selection for Zarr v2 arrays with structured dtypes. The read path now decodes chunks into a full-dtype buffer when fields are requested, then copies the selected field view into the caller-facing output buffer. That avoids trying to assign full structured records directly into a single-field or subset-field output dtype.
I added a regression test covering direct string field indexing, basic selection with a single field, and multi-field selection for v2 structured arrays.
AI assistance: OpenAI GPT-5 was used during implementation; I reviewed the change and ran the checks below.
TODO:
docs/user-guide/*.mdchanges/Local checks:
.venv/bin/python -m pytest tests/test_v2.py -q.venv/bin/python -m pytest tests/test_v2.py::test_structured_dtype_field_selection tests/test_indexing.py::test_get_selections_with_fields -q.venv/bin/python -m ruff check src/zarr/core/array.py tests/test_v2.py.venv/bin/python -m ruff format --check src/zarr/core/array.py tests/test_v2.pygit diff --check