feat(writer): cascade zigzag like Rust's ZigZagScheme (issue #410) - #436
Merged
Merged
Conversation
Parity with the reference compressor: ZigZag overrides encodeCascade and hands its unsigned output to the compressor as an open child, with Rust's descendant exclusions (Dict, RunEnd, Sparse; plus itself), and is not applicable without a negative value. It is now also a cascade candidate, as in Rust; before, it was never offered to the cascade at all. Output is byte-identical on every size comparison: FoR competes for the same columns and never needs more bits (bits(max - min) <= bits(2 * max|v|)), so it wins or ties. Rust's dict-codes ancestor rule holds by construction: codes are unsigned and ZigZag accepts signed only. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Part of #410, Rust-parity port number 2 after RunEnd (#435).
ZigZagEncodingEncoder.encodeCascade: the zigzag output (the unsigned counterpart:I32→U32, which is what our decoder already reads) becomes an open child. It is not applicable without a negative value, matching Rust'smin_is_negativeskip. The negative check is a read-only scan before anything is allocated, since ourArrayStatscarries no minimum.ZigZagScheme: Dict, RunEnd, Sparse (a bijection preserves cardinality, runs and dominance, so they would lose again), plus ZigZag itself.buildCascadeCodecsbefore, so the cascade never tried it.Size: byte-identical on every comparison (FileSizeComparison 1,161,559, GlobalDict 2,466,808, …) and on a mixed-sign probe. FoR competes for the same columns and never needs more bits:
bits(max − min) ≤ bits(2·max|v|), with a tie when the data is symmetric around zero. This PR is for parity, not size.Tests:
ZigZagEncodingEncoderTest.Cascade(I8 zigzag values including the extremes, the child dtype, exclusions, bounds from the signed values, the no-negatives skip). Green: 1,925 writer, 1,592 reader and 367 integration tests, including every vortex-jni interop suite.No CHANGELOG entry: output is unchanged, so nothing is user-visible.
🤖 Generated with Claude Code