-
Notifications
You must be signed in to change notification settings - Fork 1.5k
PERF : modify SMJ shuffle file reader to skip validation #15948
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
base: main
Are you sure you want to change the base?
Conversation
9d16d52
to
1bc8ef3
Compare
1bc8ef3
to
11bf46e
Compare
Did you test it locally? Do you have any performance numbers you can share?
|
I believe the SMJ reader is the only remaining component that hasn't been migrated to SpillManager (the write path of SMJ has already been refactored to use SpillManager). I agree it would be great to also refactor it to use |
SMJExec already use datafusion/datafusion/physical-plan/src/joins/sort_merge_join.rs Lines 1439 to 1451 in 11bf46e
but at spill read, direct read spill files datafusion/datafusion/physical-plan/src/joins/sort_merge_join.rs Lines 2311 to 2316 in 11bf46e
I will check if using SpillManager is possible. (another issue) |
I just add benchmarks for SMJExec spill read execution.
|
datafusion/physical-plan/src/lib.rs
Outdated
@@ -92,5 +92,4 @@ pub mod udaf { | |||
} | |||
|
|||
pub mod coalesce; | |||
#[cfg(test)] |
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.
To use test utilities in the bench as well. Is it okay?
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 you could avoid doing this by using the actual operators -- see comment above
|
||
fn create_test_data() -> SortMergeJoinExec { | ||
let left_batch = build_table_i32( | ||
("a1", &vec![0, 1, 2, 3, 4, 5]), |
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 a bencmark that has only 5 rows is likely going to only measure the overhead of plan setup rather than the actual performance of a large join that needs to spill
Perhaps we can increase this size to 1M rows or something (is important that b1 and b2 remain sorted)
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.
thanks for review!
now I run benchmark with 1_048_576
rows. with all row spill.
but benchmark result is little performance improvement...
SortMergeJoinExec_spill time: [79.761 s 79.858 s 79.974 s]
change: [-0.7912% -0.5805% -0.3386%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 1 outliers among 10 measurements (10.00%)
1 (10.00%) high mild
It seems that skip validation is small impact on the overall execution.
datafusion/physical-plan/src/lib.rs
Outdated
@@ -92,5 +92,4 @@ pub mod udaf { | |||
} | |||
|
|||
pub mod coalesce; | |||
#[cfg(test)] |
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 you could avoid doing this by using the actual operators -- see comment above
use datafusion_physical_expr::expressions::Column; | ||
use datafusion_physical_plan::common::collect; | ||
use datafusion_physical_plan::joins::SortMergeJoinExec; | ||
use datafusion_physical_plan::test::{build_table_i32, TestMemoryExec}; |
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 worry that using test only structures like this will means the benchmark is not measuring performance that will map directly to query performance. I think you could move the file from
datafusion/physical-plan/benches/sort_merge_join.rs
to
datafusion/core/benches/sort_merge_join.rs
And use a SessionContext and actual query to run to be closer.
Here is an example that does something similar: https://github.com/apache/datafusion/blob/main/datafusion/core/benches/filter_query_sql.rs
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 moved file to
/core/benches
/ - try to using actual query by SessionContext, but it is hard to simulate.
Because It satisfied SMJExec+spill execution, but securing enough memory for operations like RepartitionExec was challenging.
f0779c9
to
28839e3
Compare
Which issue does this PR close?
Rationale for this change
#14078 #15454 shows when read shuffle file, skipping validation is effective.
What changes are included in this PR?
when SortMergeJoinExec read shuffle file, skipping validation
Are these changes tested?
Are there any user-facing changes?
no