@@ -457,15 +457,15 @@ impl PruningPredicate {
457
457
/// details.
458
458
pub fn try_new ( expr : Arc < dyn PhysicalExpr > , schema : SchemaRef ) -> Result < Self > {
459
459
// 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
461
461
let expr = snapshot_physical_expr ( expr) ?;
462
462
let unhandled_hook = Arc :: new ( ConstantUnhandledPredicateHook :: default ( ) ) as _ ;
463
463
464
464
// build predicate expression once
465
465
let mut required_columns = RequiredColumns :: new ( ) ;
466
466
let predicate_expr = build_predicate_expression (
467
467
& expr,
468
- schema. as_ref ( ) ,
468
+ & schema,
469
469
& mut required_columns,
470
470
& unhandled_hook,
471
471
) ;
@@ -520,9 +520,9 @@ impl PruningPredicate {
520
520
// If `contained` returns false, that means the column is
521
521
// not any of the values so we can prune the container
522
522
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
524
524
// 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
526
526
// column is only in the set of values so we can prune the
527
527
// container
528
528
Guarantee :: NotIn => {
@@ -876,7 +876,7 @@ impl From<Vec<(phys_expr::Column, StatisticsType, Field)>> for RequiredColumns {
876
876
877
877
/// Build a RecordBatch from a list of statistics, creating arrays,
878
878
/// with one row for each PruningStatistics and columns specified in
879
- /// in the required_columns parameter.
879
+ /// the required_columns parameter.
880
880
///
881
881
/// For example, if the requested columns are
882
882
/// ```text
@@ -960,7 +960,7 @@ impl<'a> PruningExpressionBuilder<'a> {
960
960
left : & ' a Arc < dyn PhysicalExpr > ,
961
961
right : & ' a Arc < dyn PhysicalExpr > ,
962
962
op : Operator ,
963
- schema : & ' a Schema ,
963
+ schema : & ' a SchemaRef ,
964
964
required_columns : & ' a mut RequiredColumns ,
965
965
) -> Result < Self > {
966
966
// find column name; input could be a more complicated expression
@@ -978,8 +978,7 @@ impl<'a> PruningExpressionBuilder<'a> {
978
978
}
979
979
} ;
980
980
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) ) ?;
983
982
let ( column_expr, correct_operator, scalar_expr) = rewrite_expr_to_prunable (
984
983
column_expr,
985
984
correct_operator,
@@ -1369,7 +1368,7 @@ impl PredicateRewriter {
1369
1368
let mut required_columns = RequiredColumns :: new ( ) ;
1370
1369
build_predicate_expression (
1371
1370
expr,
1372
- schema,
1371
+ & Arc :: new ( schema. clone ( ) ) ,
1373
1372
& mut required_columns,
1374
1373
& self . unhandled_hook ,
1375
1374
)
@@ -1387,7 +1386,7 @@ impl PredicateRewriter {
1387
1386
/// Notice: Does not handle [`phys_expr::InListExpr`] greater than 20, which will fall back to calling `unhandled_hook`
1388
1387
fn build_predicate_expression (
1389
1388
expr : & Arc < dyn PhysicalExpr > ,
1390
- schema : & Schema ,
1389
+ schema : & SchemaRef ,
1391
1390
required_columns : & mut RequiredColumns ,
1392
1391
unhandled_hook : & Arc < dyn UnhandledPredicateHook > ,
1393
1392
) -> Arc < dyn PhysicalExpr > {
@@ -5131,7 +5130,12 @@ mod tests {
5131
5130
) -> Arc < dyn PhysicalExpr > {
5132
5131
let expr = logical2physical ( expr, schema) ;
5133
5132
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
+ )
5135
5139
}
5136
5140
5137
5141
#[ test]
0 commit comments