Corgi reduce: value ids from a merge of the input runs - #895
Closed
frankmcsherry wants to merge 1 commit into
Closed
frankmcsherry wants to merge 1 commit into
frankmcsherry wants to merge 1 commit into
Conversation
Under primitive keys, present the reduce input by merging each key's runs across the chunks in value order, instead of gathering the matched rows, hashing compound values, and consolidating. Each distinct value is met once with all of its records, which consolidate there, and gets its id there: primitive values keep value-as-id, and others get the next ordinal, which the input pool resolves to the chunk row where the merge met it. Ids ascend with values, so the bridge is built in order, with no hash or map, and no column is gathered unless the reducer asks for values. Hashed keys, and values that are not products of `u64` leaves, keep the content-hash path (`present_input`). Input ids resolve only through the input pool, and output ids are still derived from output columns, so the two id spaces never meet. Same-plan harness, 1 worker, median of 3 (before -> after; `count2` and `min2` have two-field values): count2 1M rows, 1000 x 500 load 145 -> 85.4 ms churn 4.81 -> 3.56 ms/round count2 1M rows, 10000 x 60 load 145 -> 86.9 ms churn 31.8 -> 21.7 min2 1M rows, 1000 x 500 load 163 -> 96.2 ms churn 4.40 -> 3.08 min2 1M rows, 10000 x 60 load 162 -> 96.1 ms churn 31.6 -> 20.0 count 1M rows, 1000 x 500 load 86.2 -> 81.1 ms churn 3.54 -> 3.42 min 1M rows, 1000 x 500 load 86.5 -> 81.5 ms churn 2.71 -> 2.60 distinct 1M rows, 1000 x 500 load 84.9 -> 81.6 ms churn 2.45 -> 2.33 reach 2M edges, 1000 x 100 load 680 -> 675 ms churn 76.6 -> 75.5 scc 200k edges, 100 x 50 load 667 -> 666 ms churn 35.3 -> 34.8 Peak RSS for a 4M-row load: count 1145 -> 805 MiB, count2 1397 -> 846 MiB, distinct 1145 -> 804 MiB. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Sep 22, 2026
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.
Stacked on #894.
Under primitive keys, present the reduce input by merging each key's runs across the chunks in value order, instead of gathering the matched rows, hashing compound values, and consolidating. Each distinct value is met once with all of its records, which consolidate there, and gets its id there: primitive values keep value-as-id, and others get the next ordinal, which the input pool resolves to the chunk row where the merge met it. Ids ascend with values, so the bridge is built in order, with no hash or map, and no column is gathered unless the reducer asks for values.
Hashed keys, and values that are not products of
u64leaves, keep the content-hash path (present_input). Input ids resolve only through the input pool, and output ids are still derived from output columns, so the two id spaces never meet.Same-plan harness, 1 worker, median of 3 (before -> after;
count2andmin2have two-field values):Peak RSS for a 4M-row load: count 1145 -> 805 MiB, count2 1397 -> 846 MiB, distinct 1145 -> 804 MiB.
Comment changed:
next_window's "equal values share a content-hash id" now reads "equal values share an id".Validation: outputs match compiled DD on the harness cases at 1 and 4 workers; workspace tests pass.
🤖 Generated with Claude Code