adapters: fix OOM in ad-hoc query hashing for large data#6016
Open
adapters: fix OOM in ad-hoc query hashing for large data#6016
Conversation
Replace arrow-digest's RecordDigestV0 (order-dependent, required sorting the entire DataFrame) with a streaming, order-independent BatchHasher. The old approach sorted rows by every column before hashing. For large views it lead to OOM. The new approach uses DataFusion's create_hashes with two independent ahash seeds, accumulating row hashes via wrapping addition (commutative — no sort needed). Memory usage is O(batch_size). Signed-off-by: Swanand Mulay <73115739+swanandx@users.noreply.github.com>
Signed-off-by: feldera-bot <feldera-bot@feldera.com>
mythical-fred
suggested changes
Apr 10, 2026
mythical-fred
left a comment
There was a problem hiding this comment.
One blocker: please squash the [ci] apply automatic fixes commit. Dirty history is still a hard no for ready PRs.
gz
approved these changes
Apr 10, 2026
| fn new() -> Self { | ||
| Self { | ||
| rs1: ahash::RandomState::with_seeds('M' as u64, 'U' as u64, 'A' as u64, 'Y' as u64), | ||
| rs2: ahash::RandomState::with_seeds('T' as u64, 'H' as u64, 'A' as u64, 'I' as u64), |
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.
Replace arrow-digest's RecordDigestV0 (order-dependent, required sorting the entire DataFrame) with a streaming, order-independent BatchHasher.
The old approach sorted rows by every column before hashing. For large views it lead to OOM. The new approach uses DataFusion's create_hashes with two independent ahash seeds, accumulating row hashes via wrapping addition (commutative — no sort needed).
Memory usage is O(batch_size).
Describe Manual Test Plan
tested by adding tests 💡
Checklist
Breaking Changes?
Describe Incompatible Changes
Yes, it changes the HASH generation, invalidating older hashes for same data. But we only use it internally so should be fine.