This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 7f25d9dd63 Minor: some cosmetics in `filter.rs`, fix clippy due to 
logical conflict (#11368)
7f25d9dd63 is described below

commit 7f25d9dd63918ecfeecaa5810d2a5c4fc9155c5d
Author: Oleks V <[email protected]>
AuthorDate: Tue Jul 9 14:09:57 2024 -0700

    Minor: some cosmetics in `filter.rs`, fix clippy due to logical conflict 
(#11368)
    
    * Minor: some cosmetics in `filter.rs`
    
    * Minor: some cosmetics in `filter.rs`
---
 datafusion/physical-plan/src/filter.rs | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to