Skip to content

DDIR: reuse join presentation scratch across keys - #941

Merged
frankmcsherry merged 1 commit into
TimelyDataflow:master-nextfrom
frankmcsherry:ddir-join-scratch
Oct 18, 2026
Merged

frankmcsherry merged 1 commit into
TimelyDataflow:master-nextfrom
frankmcsherry:ddir-join-scratch

Conversation

@frankmcsherry

Copy link
Copy Markdown
Member

Join presentation allocated two run-description vectors per matching key, plus merge-head scratch for compound values spread across chunks. Keep up to four borrowed run descriptions inline and reuse each side's merge-head capacity across keys. Larger run sets still spill; the presentation algorithm, payload columns and consolidation are unchanged.

The regression spans seven chunks, compound values, cancellation and successive keys, exercising both spilling and scratch reuse. This PR changes only interactive/src/corgi/join.rs.

An isolated 50,000-key control, with two values per key, measured:

Values / chunks Before ns/key After ns/key Before allocation calls After
Integer / 1 69.8 55.7 100,112 112
Integer / 4 167.9 163.3 100,126 126
Pair / 1 63.7 49.9 100,140 140
Pair / 4 337.8 309.5 200,238 252

Apple M4, System allocator, scalar u64 time; medians of three alternating runs with 21 timing repetitions each, and a separate allocation pass. The timer covers join presentation and bridge checks over prebuilt native columns, excluding ingestion, sorting, proxy matching, projection and scheduling. These are historical stage measurements, not a whole-query speedup claim.

Validation: cargo test -p interactive --lib --test corgi_backend --test corgi_chunk_merge passes (one existing ignored scale test); git diff --check passes.

Based directly on current master-next (0b41ba7), with the existing Corgi pin. Independent of the reduction PR and the proposed scalar-comparator refresh. Benchmark programs and raw reports are retained in the local audit, outside this PR.

Keep up to four borrowed run descriptions inline, and reuse each side's
cross-chunk merge heads across keys. This removes two run-description
allocations per matching key and repeated compound-value merge scratch
allocation without changing presentation or consolidation.

Keep the regression for seven chunks, cancellation and successive keys,
which exercises both inline-capacity spilling and scratch reuse.
@frankmcsherry
frankmcsherry merged commit 2008da8 into TimelyDataflow:master-next Oct 18, 2026
6 checks passed
frankmcsherry added a commit that referenced this pull request Oct 18, 2026
* DDIR: reuse join presentation scratch across keys

Keep up to four borrowed run descriptions inline, and reuse each side's
cross-chunk merge heads across keys. This removes two run-description
allocations per matching key and repeated compound-value merge scratch
allocation without changing presentation or consolidation.

Keep the regression for seven chunks, cancellation and successive keys,
which exercises both inline-capacity spilling and scratch reuse.

* DDIR: batch join key validation over borrowed columns

Check all matched identifier-run endpoints in a block through Corgi's
borrowed equality API, omitting self and duplicate endpoint checks. Batch
collision-pair filtering too, and delete the per-key one_key helper.
Keep primitive identifiers streaming, without unnecessary block metadata.

Retain structural value merging and collision staging as fallbacks. Add
cross-side/chunk collision coverage for symmetric and both lopsided joins.
Build on the scratch reuse in #941; pin the API from WIP #105.

* DDIR: share batched key-run validation with reduction

Move join's iterator-based endpoint check into corgi/chunk.rs. The reduce
PR carries the identical helper so each PR builds independently and their
merged source retains one implementation.

Pin the stable-order borrowed equality implementation from WIP #105.

* DDIR: batch comparisons directly by source column pair

* DDIR: pin merged indexed Corgi comparisons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant