Fix v2 structured field selection#3996
Conversation
9632e91 to
e9e8350
Compare
|
Pushed a follow-up for the min-deps CI failure. The failure was caused by package version discovery selecting the auxiliary Additional local checks: |
|
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.49% 93.54% +0.04%
==========================================
Files 88 88
Lines 11873 11877 +4
==========================================
+ Hits 11101 11110 +9
+ Misses 772 767 -5
🚀 New features to boost your workflow:
|
1719914 to
05be8b3
Compare
|
Thanks, I read through #3983. I agree the API question around string The code change is currently in the shared I will hold off on further code changes until there is a clearer direction on that API choice. |
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