Add AbstractChunkKeyEncoding - #234
Conversation
|
I'm pretty sure that we at least need an abstract type. I could be convinced to not use the word "key", but I do think this will be confusing. |
asinghvi17
left a comment
There was a problem hiding this comment.
This seems fine to me. I think we don't yet set the API for that, but we can probably do that later. I don't think that's necessary quite yet.
|
If the suffix type advances in zarr-extensions, I think we should consider integrating it into the main |
|
|
||
| """Metadata for Zarr version 3 arrays""" | ||
| struct MetadataV3{T,N,C,F} <: AbstractMetadata{T,N,C,F} | ||
| struct MetadataV3{T,N,C,F,E} <: AbstractMetadata{T,N,C,F,E} |
There was a problem hiding this comment.
@asinghvi17 Do we need a type parameter for the ChunkKeyEncoding?
There was a problem hiding this comment.
Makes sense to me, yeah. I added an extra comment about constraining that at the abstract type level.
|
A prefix chunk key encoding scheme has appeared: |
|
Nightly CI is an expected failure from CondaPkg, I would not worry about that too much. Perhaps we should not load CondaPkg on nightly... The doctest failure is a bit odd though |
|
There is an available patch. I was thinking we should test that patch on nightly. |
I fixed docs build on #237. |
|
I intend to merge this if CI passes here. |
Pull Request Test Coverage Report for Build 23070014955Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
I will follow this up with another pull request to test adding the |
|
Actually, I think I will wait for #232 to merge into master. |
Co-authored-by: Anshul Singhvi <anshulsinghvi@gmail.com>
8970310 to
5fc50ef
Compare
| E = ChunkKeyEncoding | ||
| else | ||
| error("Unknown chunk key encoding: ", chunk_key_encoding["name"]) | ||
| end | ||
|
|
||
| MetadataV3{TU, N, typeof(pipeline)}( | ||
| MetadataV3{TU, N, typeof(pipeline),ChunkKeyEncoding}( |
There was a problem hiding this comment.
I'm not seeing where E gets used here
There was a problem hiding this comment.
| E = ChunkKeyEncoding | |
| else | |
| error("Unknown chunk key encoding: ", chunk_key_encoding["name"]) | |
| end | |
| MetadataV3{TU, N, typeof(pipeline)}( | |
| MetadataV3{TU, N, typeof(pipeline),ChunkKeyEncoding}( | |
| E = ChunkKeyEncoding | |
| else | |
| error("Unknown chunk key encoding: ", chunk_key_encoding["name"]) | |
| end | |
| MetadataV3{TU, N, typeof(pipeline),E}( |
perhaps?
There was a problem hiding this comment.
This may have been caught between commits. I added a SuffixChunkKeyEncoding to see how this might generalize across multiple AbstractChunkKeyEncodings.
|
I've added a My current expectation is that introducing a new type here will cause some type instability. |
|
Thinking about this, perhaps we are being inconsistent with naming. Some of the abstract types do not start with |
|
True, but then they probably should start with Abstract (in my opinion, anyway :D) |
* Implement a registration system for chunk key encoding
* refactor: Add typed ChunkKeyEncodingEntry to chunk key encoding registration
Introduce `ChunkKeyEncodingEntry` struct pairing
`return_type::Type{<:AbstractChunkKeyEncoding}` with `parser::Function`,
replacing the bare `Dict{String, Function}` registry.
- `register_chunk_key_encoding(parser, name, ::Type{T}=AbstractChunkKeyEncoding)`
now stores a `ChunkKeyEncodingEntry` with the declared return type; the type
is the last (optional) argument to work naturally with do-block syntax
- `parse_chunk_key_encoding` asserts the result against `entry.return_type`
at runtime
- All built-in registrations updated with their specific concrete types
(`ChunkKeyEncoding` for "default" and "v2", `SuffixChunkKeyEncoding` for
"suffix")
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
AbstractChunkKeyEncodingChunkEncodingtoChunkKeyEncodingChunk Key Encodings are a potential extension point in Zarr:
https://zarr-specs.readthedocs.io/en/latest/v3/chunk-key-encodings/index.html
There are two chunk key encoding extensions:
feat: Add
suffixchunk key encoding zarr-developers/zarr-extensions#28Fanout chunk key encoding zarr-developers/zarr-extensions#31
Thus, I think we need an
AbstractChunkKeyEncodingto allow for alternatechunk key encoding extensions.
While
ChunkEncodingis a shorter name, it could be confused with theencoding of a chunk itself rather than it's name. Including the word "Key"
would make it clearer that we are indeed referring to the Zarr v3 concept
of a "chunk key encoding".