Reduce lazy masks into arrays with all-valid metadata - #10016
Conversation
Merging this PR will regress 4 benchmarks
|
774f3e3 to
94701b5
Compare
94701b5 to
1ed352c
Compare
1ed352c to
2c3bd7f
Compare
2c3bd7f to
0c55830
Compare
ec0a8a9 to
d09f2a1
Compare
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
d09f2a1 to
a8d283b
Compare
| /// | ||
| /// Enables lazy masks on all-valid inputs. Only opt in when `array.validity()` cannot read | ||
| /// buffers or execute children, including for nullable inputs. | ||
| const VALIDITY_IS_METADATA_ONLY: bool = false; |
There was a problem hiding this comment.
should this be on the main vtable?
There was a problem hiding this comment.
honestly I would like that
Depends on #10016. RowFn output payloads bypass the execution allocator. This change allocates them directly through `ctx.allocator()` across owned, deferred-retry, selected, filtered, constant, and sink execution, while preserving zero-copy primitive publication and empty-output paths. `OutputElement` chooses its collection storage through an associated buffer type and an allocation hook. The executor writes through `OutputBuffer` slots, and the buffer implementation constructs the array. Vortex primitive and Boolean implementations use `BufferMut`, while scalar and fixed-size-list sinks use the same storage contract. UTF-8 descriptors, external bytes, and polygon payloads also use the execution allocator. Physical sink parameters remain separate from allocation resources. Regressions check ownership of returned payloads using canonical inputs prepared before allocation tracking, including a context override, constant UTF-8 output, retry execution, and zero-copy reuse. A zero-sized output with `Vec` storage exercises the owned execution paths without requiring `BufferMut`. Boolean collector selection is preserved. The Boolean dense-retry path from merged #9986 also uses the execution allocator, with coverage in the existing packed-output allocator test. Validation before the rebase: 168 focused comparison, mask, and RowFn tests passed on the combined stack through #9979, along with `cargo clippy -p vortex-array --all-targets --all-features -- -D warnings`. Tests, formatting, and benchmarks were not rerun locally after the rebase. --------- Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Summary
Allows lazy masks to attach directly as validity when an encoding can inspect validity through metadata and the input is
AllValidorNonNullable. Array-backed validity and encodings that have not opted in retain the existing lazy-mask fallback.The reduction rule, in pseudocode, is:
This applies when the input encoding opts into
VALIDITY_IS_METADATA_ONLYand supports mask reduction.mis a non-nullable Boolean array with the same length as the input, and it may be lazy. The reduction reuses the values and attachesmas validity without executing it. The output dtype is nullable.The identity is
AllValid AND m = m, so no intermediate validity array is needed.Changes
Adds
MaskReduce::VALIDITY_IS_METADATA_ONLY, defaulting to false, and enables it for Boolean, primitive, decimal, string, list, struct, map, and ByteBool encodings. String, decimal, and list reducers preserve existing buffers and children when rebuilding. List-view masking also preserves its metadata without revalidating the zero-copy flag.Two focused tests cover direct attachment to an all-valid primitive array and the fallback for array-backed validity, including an all-true bitmap. Existing constant-mask tests remain unchanged, and all tests stay inline. The Boolean device-buffer fix landed in #10018.
Validation before the rebase: 168 focused comparison, mask, and RowFn tests passed on the combined stack through #9979, along with
cargo clippy -p vortex-array --all-targets --all-features -- -D warnings. The rebase preserves this PR's patches. Tests, formatting, and benchmarks were not rerun locally after the rebase.