@@ -457,15 +457,15 @@ impl PruningPredicate {
457457 /// details.
458458 pub fn try_new ( expr : Arc < dyn PhysicalExpr > , schema : SchemaRef ) -> Result < Self > {
459459 // Get a (simpler) snapshot of the physical expr here to use with `PruningPredicate`
460- // which does not handle dynamic exprs in general
460+ // which does not handle dynamic exprs in general
461461 let expr = snapshot_physical_expr ( expr) ?;
462462 let unhandled_hook = Arc :: new ( ConstantUnhandledPredicateHook :: default ( ) ) as _ ;
463463
464464 // build predicate expression once
465465 let mut required_columns = RequiredColumns :: new ( ) ;
466466 let predicate_expr = build_predicate_expression (
467467 & expr,
468- schema. as_ref ( ) ,
468+ & schema,
469469 & mut required_columns,
470470 & unhandled_hook,
471471 ) ;
@@ -520,9 +520,9 @@ impl PruningPredicate {
520520 // If `contained` returns false, that means the column is
521521 // not any of the values so we can prune the container
522522 Guarantee :: In => builder. combine_array ( & results) ,
523- // `NotIn` means the values in the column must must not be
523+ // `NotIn` means the values in the column must not be
524524 // any of the values in the set for the predicate to
525- // evaluate to true. If contained returns true, it means the
525+ // evaluate to true. If ` contained` returns true, it means the
526526 // column is only in the set of values so we can prune the
527527 // container
528528 Guarantee :: NotIn => {
@@ -876,7 +876,7 @@ impl From<Vec<(phys_expr::Column, StatisticsType, Field)>> for RequiredColumns {
876876
877877/// Build a RecordBatch from a list of statistics, creating arrays,
878878/// with one row for each PruningStatistics and columns specified in
879- /// in the required_columns parameter.
879+ /// the required_columns parameter.
880880///
881881/// For example, if the requested columns are
882882/// ```text
@@ -960,7 +960,7 @@ impl<'a> PruningExpressionBuilder<'a> {
960960 left : & ' a Arc < dyn PhysicalExpr > ,
961961 right : & ' a Arc < dyn PhysicalExpr > ,
962962 op : Operator ,
963- schema : & ' a Schema ,
963+ schema : & ' a SchemaRef ,
964964 required_columns : & ' a mut RequiredColumns ,
965965 ) -> Result < Self > {
966966 // find column name; input could be a more complicated expression
@@ -978,8 +978,7 @@ impl<'a> PruningExpressionBuilder<'a> {
978978 }
979979 } ;
980980
981- // TODO pass in SchemaRef so we don't need to clone the schema
982- let df_schema = DFSchema :: try_from ( schema. clone ( ) ) ?;
981+ let df_schema = DFSchema :: try_from ( Arc :: clone ( schema) ) ?;
983982 let ( column_expr, correct_operator, scalar_expr) = rewrite_expr_to_prunable (
984983 column_expr,
985984 correct_operator,
@@ -1369,7 +1368,7 @@ impl PredicateRewriter {
13691368 let mut required_columns = RequiredColumns :: new ( ) ;
13701369 build_predicate_expression (
13711370 expr,
1372- schema,
1371+ & Arc :: new ( schema. clone ( ) ) ,
13731372 & mut required_columns,
13741373 & self . unhandled_hook ,
13751374 )
@@ -1387,7 +1386,7 @@ impl PredicateRewriter {
13871386/// Notice: Does not handle [`phys_expr::InListExpr`] greater than 20, which will fall back to calling `unhandled_hook`
13881387fn build_predicate_expression (
13891388 expr : & Arc < dyn PhysicalExpr > ,
1390- schema : & Schema ,
1389+ schema : & SchemaRef ,
13911390 required_columns : & mut RequiredColumns ,
13921391 unhandled_hook : & Arc < dyn UnhandledPredicateHook > ,
13931392) -> Arc < dyn PhysicalExpr > {
@@ -5131,7 +5130,12 @@ mod tests {
51315130 ) -> Arc < dyn PhysicalExpr > {
51325131 let expr = logical2physical ( expr, schema) ;
51335132 let unhandled_hook = Arc :: new ( ConstantUnhandledPredicateHook :: default ( ) ) as _ ;
5134- build_predicate_expression ( & expr, schema, required_columns, & unhandled_hook)
5133+ build_predicate_expression (
5134+ & expr,
5135+ & Arc :: new ( schema. clone ( ) ) ,
5136+ required_columns,
5137+ & unhandled_hook,
5138+ )
51355139 }
51365140
51375141 #[ test]
0 commit comments