You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/02 09:41:33 UTC
[GitHub] [arrow-datafusion] xudong963 opened a new pull request #1730: optimize hash join by reducing critical zone
xudong963 opened a new pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
NO
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
| query | opt | non-opt |
| ---- | ---- | ---- |
| 8 | 3024.62 ms | 3184.18 ms|
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] xudong963 commented on a change in pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
xudong963 commented on a change in pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730#discussion_r800196000
##########
File path: datafusion/src/physical_plan/hash_join.rs
##########
@@ -333,8 +334,10 @@ impl ExecutionPlan for HashJoinExec {
concat_batches(&self.left.schema(), &batches, num_rows)?;
let left_side = Arc::new((hashmap, single_batch));
-
- *build_side = Some(left_side.clone());
+ {
Review comment:
@Dandandan That's weird. I've tested it several times, and it hasn't changed 🤦♂️ -- I'll close the ticket and work on it when I have time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] Dandandan commented on a change in pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730#discussion_r798475931
##########
File path: datafusion/src/physical_plan/hash_join.rs
##########
@@ -333,8 +334,10 @@ impl ExecutionPlan for HashJoinExec {
concat_batches(&self.left.schema(), &batches, num_rows)?;
let left_side = Arc::new((hashmap, single_batch));
-
- *build_side = Some(left_side.clone());
+ {
Review comment:
The same, also surprised. Didn't yet benchmark this, are you sure the numbers are correct @xudong963 ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] Dandandan commented on a change in pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730#discussion_r800103083
##########
File path: datafusion/src/physical_plan/hash_join.rs
##########
@@ -333,8 +334,10 @@ impl ExecutionPlan for HashJoinExec {
concat_batches(&self.left.schema(), &batches, num_rows)?;
let left_side = Arc::new((hashmap, single_batch));
-
- *build_side = Some(left_side.clone());
+ {
Review comment:
Turns out it was some noise - can not reproduce this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on a change in pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
alamb commented on a change in pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730#discussion_r798018435
##########
File path: datafusion/src/physical_plan/hash_join.rs
##########
@@ -333,8 +334,10 @@ impl ExecutionPlan for HashJoinExec {
concat_batches(&self.left.schema(), &batches, num_rows)?;
let left_side = Arc::new((hashmap, single_batch));
-
- *build_side = Some(left_side.clone());
+ {
Review comment:
Looking at the code, it seems like by moving the acquisition of the lock down, here multiple partitions could potentially race to build the `build_side` hash map.
So I don't fully understand how this change is increasing performance. I need to think about this more 🤔
cc @Dandandan
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] xudong963 removed a comment on pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
xudong963 removed a comment on pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730#issuecomment-1027756997
opt flame graph

non-opt flame graph

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] houqp commented on a change in pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
houqp commented on a change in pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730#discussion_r798240583
##########
File path: datafusion/src/physical_plan/hash_join.rs
##########
@@ -333,8 +334,10 @@ impl ExecutionPlan for HashJoinExec {
concat_batches(&self.left.schema(), &batches, num_rows)?;
let left_side = Arc::new((hashmap, single_batch));
-
- *build_side = Some(left_side.clone());
+ {
Review comment:
Same here, I think this will result in all partitions to execute the same collect left & hashing compute. I am surprised this improves the performance, if anything it should make things slower?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] xudong963 commented on pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
xudong963 commented on pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730#issuecomment-1027756997
opt flame graph

non-opt flame graph

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] Dandandan commented on a change in pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730#discussion_r800084042
##########
File path: datafusion/src/physical_plan/hash_join.rs
##########
@@ -333,8 +334,10 @@ impl ExecutionPlan for HashJoinExec {
concat_batches(&self.left.schema(), &batches, num_rows)?;
let left_side = Arc::new((hashmap, single_batch));
-
- *build_side = Some(left_side.clone());
+ {
Review comment:
I tested this locally, also getting better performance after the change(!) for query 8.
It suggests we are doing something wrong maybe with locking (e.g. stalling some work), or we somehow perform less work in this PR? I didn't check whether we still get the right results yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] xudong963 closed pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
xudong963 closed pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] xudong963 closed pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
xudong963 closed pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] Dandandan commented on a change in pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730#discussion_r800084042
##########
File path: datafusion/src/physical_plan/hash_join.rs
##########
@@ -333,8 +334,10 @@ impl ExecutionPlan for HashJoinExec {
concat_batches(&self.left.schema(), &batches, num_rows)?;
let left_side = Arc::new((hashmap, single_batch));
-
- *build_side = Some(left_side.clone());
+ {
Review comment:
~~ tested this locally, also getting better performance after the change(!) for query 8.~~
Turns out it was some noise - can not reproduce this.
It suggests we are doing something wrong maybe with locking (e.g. stalling some work), or we somehow perform less work in this PR? I didn't check whether we still get the right results yet.
##########
File path: datafusion/src/physical_plan/hash_join.rs
##########
@@ -333,8 +334,10 @@ impl ExecutionPlan for HashJoinExec {
concat_batches(&self.left.schema(), &batches, num_rows)?;
let left_side = Arc::new((hashmap, single_batch));
-
- *build_side = Some(left_side.clone());
+ {
Review comment:
~~tested this locally, also getting better performance after the change(!) for query 8.~~
Turns out it was some noise - can not reproduce this.
It suggests we are doing something wrong maybe with locking (e.g. stalling some work), or we somehow perform less work in this PR? I didn't check whether we still get the right results yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] xudong963 commented on a change in pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
xudong963 commented on a change in pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730#discussion_r798560150
##########
File path: datafusion/src/physical_plan/hash_join.rs
##########
@@ -333,8 +334,10 @@ impl ExecutionPlan for HashJoinExec {
concat_batches(&self.left.schema(), &batches, num_rows)?;
let left_side = Arc::new((hashmap, single_batch));
-
- *build_side = Some(left_side.clone());
+ {
Review comment:
I doubt myself a little bit, I need to do more perf and bench to verify. 🤣
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] Dandandan commented on a change in pull request #1730: optimize hash join by reducing critical zone
Posted by GitBox <gi...@apache.org>.
Dandandan commented on a change in pull request #1730:
URL: https://github.com/apache/arrow-datafusion/pull/1730#discussion_r800084042
##########
File path: datafusion/src/physical_plan/hash_join.rs
##########
@@ -333,8 +334,10 @@ impl ExecutionPlan for HashJoinExec {
concat_batches(&self.left.schema(), &batches, num_rows)?;
let left_side = Arc::new((hashmap, single_batch));
-
- *build_side = Some(left_side.clone());
+ {
Review comment:
I tested this locally, also getting better performance after the change(!).
It suggests we are doing something wrong maybe with locking (e.g. stalling some work), or we somehow perform less work in this PR? I didn't check whether we still get the right results yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org