-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Improve the hash join performance by replacing the RawTable to a simple Vec for JoinHashMap #6913
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
Conversation
…le Vec for JoinHashMap
let bucket_index = self.bucket_mask & (hash_value as usize); | ||
// We are sure the `bucket_index` is legal | ||
unsafe { | ||
let index_ref = self.buckets.get_unchecked_mut(bucket_index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can limit the unsafe to:
let index_ref = self.buckets.get_unchecked_mut(bucket_index); | |
let index_ref = unsafe {self.buckets.get_unchecked_mut(bucket_index); } |
} | ||
|
||
impl fmt::Debug for JoinHashMap { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?
Thanks @yahoNanJing . These are my results on this PR (
|
FYI, I have a branch where I got a bit better results with a similar approach (but still mixed): https://github.com/apache/arrow-datafusion/tree/bucketing, you can see the diff here f03f7f4 |
Hi @Dandandan, could you help run the latest code of this PR on your PC for benchmark again? Btw, on my PC, I'm testing on TPCH 1G with single partition |
Sure @yahoNanJing
![]()
|
Last commit d639244:
|
FYI @sunchao who I believe is working on something similar. |
Thanks for providing this useful benchmark tool. I'll try it later. |
My explanation so far: The building phase is faster this way (simple datastructure) at the expense of the probing phase (due to more colissions and thus more rows to check for potential collisions). I think we might first have to see if we can further improve the collision checking (currently |
Btw, I propose to set the partition to be 1 for benchmark purpose due to:
|
Intuitively, I think the Vec is much simpler than the RawTable and the mask operation should be very efficient. And I don't know why the result seems not so good 😭 |
Sorry, hit enter too soon, I updated my comment with my full thoughts on this. |
You are right. I will continue to investigate on it. |
The main blocking issue for q17 is the join order and the decision making of choosing which part to be the build side. I think we can close this issue. |
Which issue does this PR close?
Closes #6910.
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?