Repository navigation
Streaming merger: delegate to DuckDB (11.5x faster at high cardinality) - #34
Merged
Merged
Conversation
…ding Replace Elixir map-based lattice folding with DuckDB SQL re-aggregation. fold/2 now collects IPC binaries; to_dux/1 delegates to the batch Merger which already has the correct re-aggregation SQL. Simpler code (removed 60 lines of Elixir merge logic), same correctness guarantees, and dramatically better performance at high group cardinality. Benchmark (2 workers, 100K rows): 100 groups: 84ms → 54ms (1.6x) 10K groups: 716ms → 62ms (11.5x) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Replace the Elixir-side lattice folding in
StreamingMergerwith DuckDB SQL re-aggregation. The streaming merger now:fold/2— collects IPC binaries (no processing)to_dux/1— delegates to the batchMerger.merge_to_dux/2which already has correct re-aggregation SQLRemoved ~60 lines of Elixir map manipulation (
extract_group_key,init_group,merge_row,Map.putper row). The Lattice classification is still used for the streamability check.Benchmark (2 workers, 100K rows)
The 10K group case was bottlenecked on Elixir
Map.putper row — DuckDB handles it trivially with a GROUP BY.Test plan
🤖 Generated with Claude Code