Array position aware Bytes to Bytes Codec #4267
Replies: 1 comment 6 replies
no this is not possible, and we would not want to add this without coordination with all other implementations. the current model of chunk encoding as defined by the spec keeps the chunk index out of the signature.
the sharding codec effectively does this today when fetching a subchunk. but it applies the exact same set of inner codecs to decode subchunks, no matter where they are. A basic model of zarr so far is that a chunk decoding procedure is fully specified by a single JSON document. additional external resources like dictionaries that vary per-chunk are thus not in the picture right now. What we could do is define constructs for concatenating separate Zarr arrays, which each have their own separate chunk encodings. This would be useful more generally. |
Uh oh!
There was an error while loading. Please reload this page.
I am experimenting with OpenZL as Zarr codec, see https://github.com/carloshorn/openzl4zarr/.
OpenZL is an interesting compression library because it provides methods for training specialized compressors while including a universal decompressor. Consequently, no additional instructions or configuration parameters are required for deserialization within the Zarr codec, as would be the case with trained compression dictionaries.
My current implementation covers the case where I use a pre-trained compressor that I apply to all chunks during writing.
I can use different compressors if I write the respective chunks using different pipelines. However, this is not very user-friendly and also does not allow for sharding.
The precise question I have:
Is there a way to get the array position of a chunk within the
BytesBytesCodec._encode_syncmethod?I am aware that this is not trivial, as an array-array codec can scramble positions, for instance, via a Fourier transform, resulting in a downstream sharding codec providing chunks that no longer necessarily bear a relationship to the original positions.
One possible solution I can envision is a custom sharding codec that will take at least the "position within the shard" into account and executes my pipeline; subsequently, the attributes in the
zarr.jsonwould be adjusted so that it appears as though the data had been generated using standard sharding and my openZL bytes-bytes codec. Sounds a bit hacky to me...Thank you all in advance for any ideas or input.
All reactions