Skip to content

Apache DataFusion SQL Query Engine

Minor: some cosmetics in `filter.rs`, fix clippy due to logical conflict (#11368)

Oleks V7f25d9dd6391
diff --git a/datafusion/physical-plan/src/filter.rs b/datafusion/physical-plan/src/filter.rs
index 84afc22757..c5ba3992d3 100644
--- a/datafusion/physical-plan/src/filter.rs
+++ b/datafusion/physical-plan/src/filter.rs
@@ -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!(
+ "Cannot create filter_array from non-boolean predicates"
+ );
};
// if the predicate is null, then the result is also null