fix: preserve the source Zarr dtype in from_array - #4335
Merged
d-v-b merged 5 commits intoSep 10, 2026
Merged
Conversation
Assisted-by: Codex:gpt-6
Assisted-by: Codex:gpt-6
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4335 +/- ##
==========================================
+ Coverage 94.31% 94.34% +0.02%
==========================================
Files 92 92
Lines 12935 12935
==========================================
+ Hits 12200 12203 +3
+ Misses 735 732 -3
🚀 New features to boost your workflow:
|
d-v-b
commented
Sep 9, 2026
Assisted-by: Codex:gpt-6
Assisted-by: Codex:gpt-6
Assisted-by: Codex:gpt-6
d-v-b
marked this pull request as ready for review
September 10, 2026 10:48
Contributor
Author
|
simple bugfix, so i'm self-merging |
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 AI-authored PR ensures that
from_arrayuses the Zarr data type object, when available, instead of the numpy-like data type exposed byarray.dtype, which ensures that data types like vlen-bytes have their data type preserved via from_array.🤖 AI text below 🤖
zarr.from_array({}, data=source)fails whensourceis a variable-length bytes array. It passes the source's NumPyobjectdtype to array creation, losing the complete Zarr dtype already available in the source metadata. Inferring a storage type fromobjectthen raisesValueErrorbecause it is ambiguous.Preserve the source's explicit Zarr dtype when creating the copy. Array-like inputs continue to use their native dtype.
A parametrized test covers all 22 registered dtype examples in formats 2 and 3, checking dtype preservation and data when copying and reopening. Before the fix, both variable-length bytes cases failed.
Validation: 1,152
from_arraytests passed, 720 unsupported format-2 sharding combinations skipped. All repository commit checks passed.