Support variadic tail slots in #[array_slots] macro - #8950
Merged
Conversation
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.
Rationale for this change
The
#[array_slots]macro currently supports fixed-size slot layouts with required (ArrayRef) and optional (Option<ArrayRef>) fields. However, several encodings likeChunked,Struct, andUnionhave variable-length slot runs (e.g.,[chunk_offsets, chunks...]) that cannot be cleanly expressed with the current macro.This change extends the macro to support a variadic tail — a final field of type
Vec<ArrayRef>— enabling these encodings to use the macro-generated slot accessors and constants instead of hand-written slot index management.What changes are included in this PR?
Macro enhancements (
vortex-array-macros/src/lib.rs)SlotFieldType::VariadicTailvariant to recognizeVec<ArrayRef>fieldsfixed_specsand optionaltail_specFIXED_COUNT: number of fixed slotsFIXED_NAMES: names of fixed slots{FIELD}_OFFSET: offset where the tail beginsslot_name(idx)function: returns slot names like"chunks[3]"for tail slotsfrom_slots()andinto_slots()to handle tail draining/extendingSlotSlice<'a>instead ofVec<ArrayRef>