Canonicalize chunked nested types through the builder [builders-child-stack] - #8967
Open
robert3005 wants to merge 1 commit into
Open
Conversation
Merging this PR will degrade performance by 32.06%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
This was referenced Jul 25, 2026
Closed
robert3005
force-pushed
the
claude/chunked-canonical-via-builder-9ze0t6
branch
2 times, most recently
from
July 29, 2026 07:35
afed52f to
79f350a
Compare
robert3005
force-pushed
the
claude/chunked-canonical-via-builder-9ze0t6
branch
2 times, most recently
from
July 29, 2026 14:19
1145029 to
8f39b06
Compare
robert3005
force-pushed
the
claude/chunked-canonical-via-builder-9ze0t6
branch
from
July 31, 2026 13:35
8f39b06 to
825ab2e
Compare
robert3005
force-pushed
the
claude/chunked-canonical-via-builder-9ze0t6
branch
from
July 31, 2026 15:29
825ab2e to
ce2eb1d
Compare
robert3005
commented
Jul 31, 2026
robert3005
force-pushed
the
claude/chunked-canonical-via-builder-9ze0t6
branch
from
July 31, 2026 16:54
ce2eb1d to
cefbc8e
Compare
robert3005
force-pushed
the
claude/chunked-canonical-via-builder-9ze0t6
branch
from
July 31, 2026 17:22
cefbc8e to
0d4eb9a
Compare
robert3005
force-pushed
the
claude/chunked-canonical-via-builder-9ze0t6
branch
from
July 31, 2026 18:39
0d4eb9a to
1e8346a
Compare
robert3005
force-pushed
the
claude/chunked-canonical-via-builder-9ze0t6
branch
from
July 31, 2026 18:43
1e8346a to
0431fa7
Compare
robert3005
force-pushed
the
claude/chunked-canonical-via-builder-9ze0t6
branch
2 times, most recently
from
July 31, 2026 22:45
a9f7d31 to
9c8574c
Compare
robert3005
changed the base branch from
claude/builders-lazy-validity-9ze0t6
to
claude/constant-fast-paths-9ze0t6
July 31, 2026 22:47
robert3005
force-pushed
the
claude/chunked-canonical-via-builder-9ze0t6
branch
from
August 1, 2026 09:43
9c8574c to
0b003e4
Compare
`pack_struct_chunks`, `swizzle_fixed_size_list_chunks` and `swizzle_list_chunks` existed because `append_to_builder` used to decode a builder's children: without them, canonicalizing a `ChunkedArray` would concatenate every chunk's children instead of reusing them. Their doc comments describe what the builders now do on their own, so all three are dead weight - the generic builder path produces the same swizzled array, with each chunk's children kept as chunks of the combined child. Only `Variant` still needs a hand-written pack, because there is no variant builder. This drops the one canonicalization path that allocated its buffers through the session allocator: `swizzle_list_chunks` allocated its offsets and sizes with `ctx.allocator()`, whereas `builder_with_capacity_in` still ignores the allocator it is handed, so chunked primitives, structs and FSLs already went around it. `list_canonicalize_uses_memory_session_allocator` guarded that one path and goes with it; restoring the property means teaching the builders to allocate through a `HostAllocatorRef`, not keeping a bespoke list swizzle alive. Signed-off-by: Claude <noreply@anthropic.com> Signed-off-by: Robert Kruszewski <robert@spiraldb.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
robert3005
force-pushed
the
claude/chunked-canonical-via-builder-9ze0t6
branch
from
August 1, 2026 10:19
0b003e4 to
876aa4e
Compare
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.
Rationale for this change
Stacked on #8966 → #8964 → #9064 → #9046 — review those first. This is the payoff for the rest of the stack.
ChunkedArray's_canonicalizecarried four hand-written special cases plus a genericappend_to_builderfallback. Two of them existed purely becauseappend_to_builderused to decode a builder's children; their doc comments say so:pack_struct_chunks— "a singleStructArray, where the data for each field is aChunkedArray"swizzle_fixed_size_list_chunks— "reuse the chunks'elementschildren directly as the chunks of a combinedelementsarray without copying"That is what
ChildBuilderdoes now, so both are dead weight — an extra path to keep correct for a result the generic path already produces.What changes are included in this PR?
DType::StructandDType::FixedSizeListfall through to the builder, and both helpers are deleted. Nothing has to be configured for this to work: since #8964 a nested builder keeps every appended chunk however short, which is the behaviour the swizzles hand-rolled. An earlier revision of this PR calledbuilder.set_min_chunk_len(0)here to opt out of a length threshold that no longer exists.I verified the shapes match before deleting anything. A
tree_displayprobe over chunked struct / list / FSL inputs produces byte-identical trees on both paths for chunks of 200 rows — struct field isvortex.chunked(i32, len=400)with two chunks, FSLelementslikewise. Two newrstestcases lock that in using chunks of one row.What is not included
ListArraykeepsswizzle_list_chunks. The builder produces the same shape —is_zero_copy_to_list: trueand all — but the swizzle also allocates its offsets and sizes throughctx.allocator(), and builders are not allocator-aware:builder_with_capacity_intakes aHostAllocatorRefand discards it (let _allocator = allocator;).list_canonicalize_uses_memory_session_allocatorcatches exactly this. Making it work means threading an allocator throughBufferMutinvortex-buffer, which has none today — a bigger and separate piece of work than this stack, so the list swizzle stays until someone does it.pack_variant_chunksstays too:builder_with_capacityisunimplemented!()forDType::Variant.StructArray::try_concatis now unused in-tree. It ispub, and a useful helper in its own right, so I left it — removing public API seemed like a separate call for a reviewer to make rather than something to slip into this PR.What APIs are changed? Are there any user-facing changes?
No API changes, and no observable difference: the generic builder path preserves every chunk boundary, which is exactly what the swizzles did.
Checks
cargo nextest run --workspace— 7168 passed, 560 skippedcargo clippy --all-targets --all-features— cleancargo +nightly fmt --all --check— cleanGenerated by Claude Code
Stacked PR Chain: builders-child-stack
Generated by Claude Code