-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Minor: some cosmetics in filter.rs
, fix clippy due to logical conflict
#11368
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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 |
---|---|---|
|
@@ -15,9 +15,6 @@ | |
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
//! FilterExec evaluates a boolean predicate against all input batches to determine which rows to | ||
//! include in its output batches. | ||
use std::any::Any; | ||
use std::pin::Pin; | ||
use std::sync::Arc; | ||
|
@@ -60,7 +57,7 @@ pub struct FilterExec { | |
input: Arc<dyn ExecutionPlan>, | ||
/// Execution metrics | ||
metrics: ExecutionPlanMetricsSet, | ||
/// Selectivity for statistics. 0 = no rows, 100 all rows | ||
/// Selectivity for statistics. 0 = no rows, 100 = all rows | ||
default_selectivity: u8, | ||
cache: PlanProperties, | ||
} | ||
|
@@ -91,14 +88,14 @@ impl FilterExec { | |
|
||
Ok(Self { | ||
predicate, | ||
input: input.clone(), | ||
input: Arc::clone(&input), | ||
metrics: ExecutionPlanMetricsSet::new(), | ||
default_selectivity, | ||
cache, | ||
}) | ||
} | ||
other => { | ||
plan_err!("Filter predicate must return boolean values, not {other:?}") | ||
plan_err!("Filter predicate must return BOOLEAN values, got {other:?}") | ||
} | ||
} | ||
} | ||
|
@@ -108,7 +105,9 @@ impl FilterExec { | |
default_selectivity: u8, | ||
) -> Result<Self, DataFusionError> { | ||
if default_selectivity > 100 { | ||
return plan_err!("Default filter selectivity needs to be less than 100"); | ||
return plan_err!( | ||
"Default filter selectivity value needs to be less than or equal to 100" | ||
); | ||
} | ||
self.default_selectivity = default_selectivity; | ||
Ok(self) | ||
|
@@ -369,12 +368,12 @@ pub(crate) fn batch_filter( | |
.and_then(|v| v.into_array(batch.num_rows())) | ||
.and_then(|array| { | ||
let filter_array = match as_boolean_array(&array) { | ||
Ok(boolean_array) => { | ||
Ok(boolean_array.to_owned()) | ||
}, | ||
Ok(boolean_array) => Ok(boolean_array.to_owned()), | ||
Err(_) => { | ||
let Ok(null_array) = as_null_array(&array) else { | ||
return internal_err!("Cannot create filter_array from non-boolean predicates, unable to continute"); | ||
return internal_err!( | ||
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. ❤️ |
||
"Cannot create filter_array from non-boolean predicates" | ||
); | ||
}; | ||
|
||
// if the predicate is null, then the result is also null | ||
|
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.
This was causing clippy failures on main https://github.com/apache/datafusion/actions/runs/9857745125/job/27217695529
I think due to a logical conflict