1515// specific language governing permissions and limitations
1616// under the License.
1717
18- //! FilterExec evaluates a boolean predicate against all input batches to determine which rows to
19- //! include in its output batches.
20-
2118use std:: any:: Any ;
2219use std:: pin:: Pin ;
2320use std:: sync:: Arc ;
@@ -60,7 +57,7 @@ pub struct FilterExec {
6057 input : Arc < dyn ExecutionPlan > ,
6158 /// Execution metrics
6259 metrics : ExecutionPlanMetricsSet ,
63- /// Selectivity for statistics. 0 = no rows, 100 all rows
60+ /// Selectivity for statistics. 0 = no rows, 100 = all rows
6461 default_selectivity : u8 ,
6562 cache : PlanProperties ,
6663}
@@ -91,14 +88,14 @@ impl FilterExec {
9188
9289 Ok ( Self {
9390 predicate,
94- input : input . clone ( ) ,
91+ input : Arc :: clone ( & input ) ,
9592 metrics : ExecutionPlanMetricsSet :: new ( ) ,
9693 default_selectivity,
9794 cache,
9895 } )
9996 }
10097 other => {
101- plan_err ! ( "Filter predicate must return boolean values, not {other:?}" )
98+ plan_err ! ( "Filter predicate must return BOOLEAN values, got {other:?}" )
10299 }
103100 }
104101 }
@@ -108,7 +105,9 @@ impl FilterExec {
108105 default_selectivity : u8 ,
109106 ) -> Result < Self , DataFusionError > {
110107 if default_selectivity > 100 {
111- return plan_err ! ( "Default filter selectivity needs to be less than 100" ) ;
108+ return plan_err ! (
109+ "Default filter selectivity value needs to be less than or equal to 100"
110+ ) ;
112111 }
113112 self . default_selectivity = default_selectivity;
114113 Ok ( self )
@@ -369,12 +368,12 @@ pub(crate) fn batch_filter(
369368 . and_then ( |v| v. into_array ( batch. num_rows ( ) ) )
370369 . and_then ( |array| {
371370 let filter_array = match as_boolean_array ( & array) {
372- Ok ( boolean_array) => {
373- Ok ( boolean_array. to_owned ( ) )
374- } ,
371+ Ok ( boolean_array) => Ok ( boolean_array. to_owned ( ) ) ,
375372 Err ( _) => {
376373 let Ok ( null_array) = as_null_array ( & array) else {
377- return internal_err ! ( "Cannot create filter_array from non-boolean predicates, unable to continute" ) ;
374+ return internal_err ! (
375+ "Cannot create filter_array from non-boolean predicates"
376+ ) ;
378377 } ;
379378
380379 // if the predicate is null, then the result is also null
0 commit comments