-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: synchronize partition bounds reporting in HashJoin #17452
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
Merged
adriangb
merged 6 commits into
apache:main
from
rkrishn7:fix/wait-until-partition-bounds-reported
Sep 9, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fb0a153
print check to observe indeterminate predicate propagation to file op…
rkrishn7 02053aa
wait until partition bounds are reported by all partitions before pol…
rkrishn7 ef2c773
cleanup + clarifying docs
rkrishn7 35da826
add check to verify predicate is always present when initiating probe…
rkrishn7 c24ef79
update snap
rkrishn7 2a41ced
prefer barrier
rkrishn7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ use datafusion_datasource::{ | |
}; | ||
use datafusion_physical_expr_common::physical_expr::fmt_sql; | ||
use datafusion_physical_optimizer::PhysicalOptimizerRule; | ||
use datafusion_physical_plan::filter::batch_filter; | ||
use datafusion_physical_plan::filter_pushdown::{FilterPushdownPhase, PushedDown}; | ||
use datafusion_physical_plan::{ | ||
displayable, | ||
|
@@ -53,6 +54,7 @@ pub struct TestOpener { | |
batch_size: Option<usize>, | ||
schema: Option<SchemaRef>, | ||
projection: Option<Vec<usize>>, | ||
predicate: Option<Arc<dyn PhysicalExpr>>, | ||
} | ||
|
||
impl FileOpener for TestOpener { | ||
|
@@ -77,6 +79,12 @@ impl FileOpener for TestOpener { | |
let (mapper, projection) = factory.map_schema(&batches[0].schema()).unwrap(); | ||
let mut new_batches = Vec::new(); | ||
for batch in batches { | ||
let batch = if let Some(predicate) = &self.predicate { | ||
batch_filter(&batch, predicate)? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice I didn't know this little function existed! |
||
} else { | ||
batch | ||
}; | ||
|
||
let batch = batch.project(&projection).unwrap(); | ||
let batch = mapper.map_batch(batch).unwrap(); | ||
new_batches.push(batch); | ||
|
@@ -133,6 +141,7 @@ impl FileSource for TestSource { | |
batch_size: self.batch_size, | ||
schema: self.schema.clone(), | ||
projection: self.projection.clone(), | ||
predicate: self.predicate.clone(), | ||
}) | ||
} | ||
|
||
|
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
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
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.
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.
@adriangb This update seems correct to me
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.
Hmm the filter is more selective (generally a good thing) but I'm curious why it changed, it's not immediately coming to me why waiting would change the value of the filter. Could you help me understand why that is?
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.
Ah I believe this is simply due to the fact that the filter is now applied in
TestOpener
. The bounds on the left side have changed due to rows being filtered out so we're seeing the correct filter now.