@@ -44,10 +44,10 @@ use datafusion_physical_expr::{
44
44
aggregate:: AggregateExprBuilder , conjunction, Partitioning ,
45
45
} ;
46
46
use datafusion_physical_expr_common:: physical_expr:: fmt_sql;
47
- use datafusion_physical_optimizer:: push_down_filter :: PushdownFilter ;
47
+ use datafusion_physical_optimizer:: filter_pushdown :: FilterPushdown ;
48
48
use datafusion_physical_optimizer:: PhysicalOptimizerRule ;
49
49
use datafusion_physical_plan:: filter_pushdown:: {
50
- FilterPushdownPropagation , FilterPushdowns ,
50
+ FilterPushdownPropagation , PredicateSupports ,
51
51
} ;
52
52
use datafusion_physical_plan:: {
53
53
aggregates:: { AggregateExec , AggregateMode , PhysicalGroupBy } ,
@@ -153,22 +153,21 @@ impl FileSource for TestSource {
153
153
154
154
fn try_pushdown_filters (
155
155
& self ,
156
- filters : & [ Arc < dyn PhysicalExpr > ] ,
156
+ mut filters : Vec < Arc < dyn PhysicalExpr > > ,
157
157
config : & ConfigOptions ,
158
158
) -> Result < FilterPushdownPropagation < Arc < dyn FileSource > > > {
159
- let mut all_filters = filters. iter ( ) . map ( Arc :: clone) . collect :: < Vec < _ > > ( ) ;
160
159
if self . support && config. execution . parquet . pushdown_filters {
161
160
if let Some ( internal) = self . predicate . as_ref ( ) {
162
- all_filters . push ( Arc :: clone ( internal) ) ;
161
+ filters . push ( Arc :: clone ( internal) ) ;
163
162
}
164
163
let new_node = Arc :: new ( TestSource {
165
164
support : true ,
166
- predicate : Some ( conjunction ( all_filters . clone ( ) ) ) ,
165
+ predicate : Some ( conjunction ( filters . clone ( ) ) ) ,
167
166
statistics : self . statistics . clone ( ) , // should be updated in reality
168
167
} ) ;
169
168
Ok ( FilterPushdownPropagation {
170
- parent_filter_result : FilterPushdowns :: all_supported ( & all_filters ) ,
171
- new_node : Some ( new_node) ,
169
+ filters : PredicateSupports :: all_supported ( filters ) ,
170
+ updated_node : Some ( new_node) ,
172
171
} )
173
172
} else {
174
173
Ok ( FilterPushdownPropagation :: unsupported ( filters) )
@@ -196,7 +195,7 @@ fn test_pushdown_into_scan() {
196
195
197
196
// expect the predicate to be pushed down into the DataSource
198
197
insta:: assert_snapshot!(
199
- OptimizationTest :: new( plan, PushdownFilter { } , true ) ,
198
+ OptimizationTest :: new( plan, FilterPushdown { } , true ) ,
200
199
@r"
201
200
OptimizationTest:
202
201
input:
@@ -220,7 +219,7 @@ fn test_pushdown_into_scan_with_config_options() {
220
219
insta:: assert_snapshot!(
221
220
OptimizationTest :: new(
222
221
Arc :: clone( & plan) ,
223
- PushdownFilter { } ,
222
+ FilterPushdown { } ,
224
223
false
225
224
) ,
226
225
@r"
@@ -239,7 +238,7 @@ fn test_pushdown_into_scan_with_config_options() {
239
238
insta:: assert_snapshot!(
240
239
OptimizationTest :: new(
241
240
plan,
242
- PushdownFilter { } ,
241
+ FilterPushdown { } ,
243
242
true
244
243
) ,
245
244
@r"
@@ -264,7 +263,7 @@ fn test_filter_collapse() {
264
263
let plan = Arc :: new ( FilterExec :: try_new ( predicate2, filter1) . unwrap ( ) ) ;
265
264
266
265
insta:: assert_snapshot!(
267
- OptimizationTest :: new( plan, PushdownFilter { } , true ) ,
266
+ OptimizationTest :: new( plan, FilterPushdown { } , true ) ,
268
267
@r"
269
268
OptimizationTest:
270
269
input:
@@ -294,7 +293,7 @@ fn test_filter_with_projection() {
294
293
295
294
// expect the predicate to be pushed down into the DataSource but the FilterExec to be converted to ProjectionExec
296
295
insta:: assert_snapshot!(
297
- OptimizationTest :: new( plan, PushdownFilter { } , true ) ,
296
+ OptimizationTest :: new( plan, FilterPushdown { } , true ) ,
298
297
@r"
299
298
OptimizationTest:
300
299
input:
@@ -318,7 +317,7 @@ fn test_filter_with_projection() {
318
317
. unwrap ( ) ,
319
318
) ;
320
319
insta:: assert_snapshot!(
321
- OptimizationTest :: new( plan, PushdownFilter { } , true ) ,
320
+ OptimizationTest :: new( plan, FilterPushdown { } , true ) ,
322
321
@r"
323
322
OptimizationTest:
324
323
input:
@@ -347,7 +346,7 @@ fn test_push_down_through_transparent_nodes() {
347
346
348
347
// expect the predicate to be pushed down into the DataSource
349
348
insta:: assert_snapshot!(
350
- OptimizationTest :: new( plan, PushdownFilter { } , true ) ,
349
+ OptimizationTest :: new( plan, FilterPushdown { } , true ) ,
351
350
@r"
352
351
OptimizationTest:
353
352
input:
@@ -411,7 +410,7 @@ fn test_no_pushdown_through_aggregates() {
411
410
412
411
// expect the predicate to be pushed down into the DataSource
413
412
insta:: assert_snapshot!(
414
- OptimizationTest :: new( plan, PushdownFilter { } , true ) ,
413
+ OptimizationTest :: new( plan, FilterPushdown { } , true ) ,
415
414
@r"
416
415
OptimizationTest:
417
416
input:
0 commit comments