-
Notifications
You must be signed in to change notification settings - Fork 999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vectorize hash join collision check #50
Comments
FYI @metesynnada I'm working on a prototype. Translated the code out of https://dare.uva.nl/search?identifier=5ccbb60a-38b8-4eeb-858a-e7735dd37487 to this, which seems roughly equivalent: let mut to_check: Vec<(u64, usize)> = hash_values
.iter()
.enumerate()
.flat_map(|(row, hash_value)| {
build_hashmap
.map
.get(*hash_value, |(hash, _)| *hash_value == *hash)
.map(|(_, v)| (*v - 1, row))
})
.collect();
while to_check.len() > 0 {
// TODO Perform column-wise (vectorized) equality check
// check next items
to_check = to_check
.iter()
.flat_map(|(index, row)| {
let next = build_hashmap.next[*index as usize];
(next != 0).then(|| (next - 1, *row))
})
.collect();
} |
I will be thinking about this as well. Building an array for the equality check might improve the equality check performance, however, |
Yeah - we sure have to test real-world performance :) |
Looks like on TPC-H we get some nice improvements overall #6724 |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Further optimize the hash join algorithm
Describe the solution you'd like
There are a couple of optimizations we could implement:
equal_rows
functions. We should be able to speed this up by vectorizing this, and also specialize it for handling non-null batches too. We probably can utilize the kernelstake
andeq
here.Hashmap
but aVec
(or similar) with a certain amount of buckets (proportional to the number of rows or the expected number of keys in the left side). I tried this, but as it causes much more collisions than we have currently, it causes a big (3x) slowdown, so vectorizing the collision check is a prerequisite.Additional context
https://www.cockroachlabs.com/blog/vectorized-hash-joiner/
https://dare.uva.nl/search?identifier=5ccbb60a-38b8-4eeb-858a-e7735dd37487
The text was updated successfully, but these errors were encountered: