add cast_value - #83
Open
konstibob wants to merge 4 commits into
Open
Conversation
…t_value Fix zarr-developers#1 (correctness): CastValueConverter.roundToFloat/roundToDouble treated nearest-away as nearest-even for floating-point targets, so exact ties rounded to even instead of away from zero (spec violation for float->float narrowing). Both now round ties away from zero and fall back to nearest for non-ties. Fix zarr-developers#2 (performance): castArray now dispatches common casts (identity, float<->float, integer->integer) to primitive-arithmetic paths, avoiding the per-element Scalar/BigDecimal/BigInteger allocation of the exact path. Casts with scalar_map, uint64, or float directed-rounding fall back to the exact path, which remains the correctness reference. Adds tests for the float nearest-away tie and the integer/identity fast paths. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Drop the unused DataType target parameter from the roundTrip test helper (the target already lives in the Configuration). - Reference parseFillValue via its defining class dev.zarr.zarrjava.core.ArrayMetadata instead of the v3 subclass. - Add uint64-above-Long.MAX_VALUE coverage, exercising the exact unsigned cast path (large fill value) and the identity fast path (array data). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
normanrz
approved these changes
Jul 30, 2026
normanrz
left a comment
Member
There was a problem hiding this comment.
Looks good.
Claude added a fast-path for common conversions and fixed an issue with nearest-away float rounding
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.
implemented cast_value codec, split the value converter into seperate file to make code more clear / structured