Fix Validity::mask_eq semantics for mixed variants#8334
Open
joseph-isaacs wants to merge 1 commit into
Open
Conversation
mask_eq previously returned false for any mixed-variant pairing without executing, e.g. comparing a Validity::Array that resolves to all-true against Validity::AllValid. As validity arrays become lazy, unresolved Array variants frequently hold constant masks, making this silently wrong rather than merely conservative. mask_eq now takes the validity length and compares logical masks: constant variants keep their no-execute fast paths, and any pairing involving an Array executes both sides via execute_mask and compares the resulting Masks. NonNullable and AllValid now compare equal, since their logical masks are identical. https://claude.ai/code/session_01VPQ7dfZtijfrsjAipwXvEj Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Merging this PR will degrade performance by 18.29%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | chunked_bool_canonical_into[(1000, 10)] |
31.8 µs | 47 µs | -32.34% |
| ❌ | Simulation | chunked_varbinview_canonical_into[(1000, 10)] |
161.8 µs | 198.6 µs | -18.5% |
| ❌ | Simulation | chunked_varbinview_into_canonical[(1000, 10)] |
177.2 µs | 213.2 µs | -16.85% |
| ❌ | Simulation | chunked_varbinview_canonical_into[(100, 100)] |
274.5 µs | 308.9 µs | -11.15% |
| ❌ | Simulation | bitwise_not_vortex_buffer_mut[128] |
246.1 ns | 275.3 ns | -10.6% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/cool-bardeen-l8jlsy-2-mask-eq (4813bec) with claude/cool-bardeen-l8jlsy-1-definitely-no-nulls (4906359)
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.
Summary
PR 2 of a 4-PR stack (stacked on #8333) preparing
Validityfor lazy validity arrays.mask_eqpreviously returnedfalsefor any mixed-variant pairing without executing — e.g. aValidity::Arraythat resolves to all-true compared againstValidity::AllValid. With lazy validity arrays, unresolvedArrayvariants frequently hold constant masks, making this silently wrong rather than merely conservative.mask_eqnow takes the validitylengthand compares logical masks: constant variants keep their no-execute fast paths, and any pairing involving anArrayexecutes both sides viaexecute_maskand compares the resultingMasks (whosePartialEqis already representation-independent).NonNullableandAllValidnow compare equal, since their logical masks are identical.rstestcases covering mixed constant pairings and arrays resolving to constant masks.All existing callers (tests/asserts in vortex, datetime-parts, pco, zstd, builders, masked) are updated to pass the length.
Checks
cargo nextest run -p vortex-array(2962 passed, incl. newmask_eq_mixed_variantscases)cargo nextest run -p vortex-datetime-parts -p vortex-pco -p vortex-zstd(119 passed)cargo build --tests -p vortex,cargo clippy -p vortex-array --all-targets,cargo +nightly fmt --allhttps://claude.ai/code/session_01VPQ7dfZtijfrsjAipwXvEj
Generated by Claude Code