-
-
Notifications
You must be signed in to change notification settings - Fork 451
fix(metadata): validate codec chains against the threaded chunk spec #4352
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
Open
d-v-b
wants to merge
14
commits into
zarr-developers:main
Choose a base branch
from
d-v-b:fix/codec-chain-validation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4810e88
fix(metadata): validate codec chains against the threaded chunk spec
d-v-b 8e324b3
fix(metadata): validate size-sensitive codecs against every distinct …
d-v-b 7c1d01b
test(codecs): property-based tests for shape-changing codec chain val…
d-v-b db9bd2a
fix(codecs): validate sharded chains with the real chunk spec
d-v-b aaab193
fix(metadata): name the failing codec in chain validation errors
d-v-b d849cf3
test(properties): transpose ahead of sharding is accepted iff it tile…
d-v-b 04dd144
refactor(metadata): cut the partial-validation path and error notes f…
d-v-b aaefe61
chore: renumber changelog fragment to upstream PR 4352
d-v-b b87fd36
fix(metadata): validate factored grids without chunk enumeration
d-v-b e8c9cde
Merge branch 'main' into fix/codec-chain-validation
d-v-b 28537dc
Merge branch 'main' into fix/codec-chain-validation
d-v-b 2c56eed
Merge branch 'main' into fix/codec-chain-validation
d-v-b 8a8f3b4
fix(metadata): thread chunk grids through codec validation without en…
d-v-b 55c8bfa
fix(codecs): evolve rectilinear pipelines against the representative …
d-v-b File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Validate each codec in a chain against the chunk geometry produced by the codecs before it, including the inner codecs of a sharding codec and the actual fill value. For example, a sharding codec placed after a transpose must now divide the transposed chunks; previously it was checked against the untransposed chunk grid, which could accept chains that read back wrong data and reject valid ones. | ||
|
|
||
| Geometry is threaded through the chain as a whole chunk grid, so validation cost no longer depends on the number of distinct chunk shapes. Codecs describe how they map the grid with the new `BaseCodec.resolve_chunk_grid` method; the built-in dtype and fill-value codecs (`cast_value`, `scale_offset`, and the numcodecs `delta`, `fixedscaleoffset` and `astype` filters) declare the identity and `transpose` declares a permutation. | ||
|
|
||
| Trade-off: on a rectilinear chunk grid, a codec that overrides `resolve_metadata` without implementing `resolve_chunk_grid` makes the rest of its chain "chunk-local". Codecs after it are validated against one representative chunk (the largest edge along each axis), so a chain that is invalid only for some other chunk shape is accepted when the array is created and fails when such a chunk is first written or read. `ShardingCodec` now checks divisibility at encode and decode time, so this case raises an error instead of corrupting data. Regular chunk grids are always validated exactly. See "Chunk geometry and validation" in the extending guide. | ||
|
|
||
| The codec pipeline of a rectilinear-chunked array is now evolved against that same representative chunk shape, instead of an all-ones placeholder that broke shape-dependent codecs at array creation even when the metadata validated. |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ilan-gold this is new API on the codec abc. we need the whole chunk grid to be in-scope for resolution because combining a rectilinear chunk grid with e.g. a transpose or reshape codec creates a large number of chunk shapes, and each chunk size needs to be consistent with the subchunk grid of e.g. a sharding codec. The meaning of "consistent" will in theory vary with the downstream codecs, but for sharding we just need to ensure that each incoming chunk shape tiles the sharding chunk grid.
this would be a lot easier if the sharding codec chunk grid was semi-regular.