Skip to content

Properly extract chunk keys for arrays with a single chunk #523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

maxrjones
Copy link
Member

This PR improves ManifestStore to support ManifestArrays that only contain a single entry in paths, offsets, and lengths. It was originally included in #516 but I've pulled these changes out because they are also needed for the TIFF reader.

Comment on lines 127 to 129
if key.endswith("c"):
# Scalar arrays hold the data in the "c" key
return (0,)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand this. You're special-casing getting a scalar array by indexing into the underlying manifestarray as if it were 1D with length 1.

But AFAIK the ManifestArray doesn't currently make a special case for that? If anything it looks like scalars might not be implemented??

# TODO also cover the special case of scalar arrays

I also don't understand how your adjustments to the test in this PR cover this if statement added here.

Copy link
Member Author

@maxrjones maxrjones Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll work on adding a test for this. The existing changes to the tests were unrelated to this and instead properly specified the chunk_key_encoding.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to just raise a NotImplementedError because this edge case isn't a priority, this PR is slowing progress on TIFF support, and this edge case will be easier to test for after the HDF5 reader uses ManifestStore

@maxrjones
Copy link
Member Author

maxrjones commented Apr 3, 2025

@TomNicholas Sean and I think #516 is pretty much ready to be merged, but I'd like to get this in first to keep changes isolated between PRs. Do you have any issues with the approach of punting on the scalar array special case?

@TomNicholas
Copy link
Member

If it currently doesn't work and you're just formalizing that by raising a NotImplementedError then I think that's totally fine. Might want to raise an issue to track it if there isn't one already though.

@maxrjones maxrjones merged commit 8b67060 into zarr-developers:develop Apr 3, 2025
10 checks passed
@maxrjones maxrjones deleted the improve-chunk-key-parsing branch April 3, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants