@@ -27,6 +27,7 @@ use datafusion_datasource::{
2727} ;
2828use datafusion_physical_expr_common:: physical_expr:: fmt_sql;
2929use datafusion_physical_optimizer:: PhysicalOptimizerRule ;
30+ use datafusion_physical_plan:: filter:: batch_filter;
3031use datafusion_physical_plan:: filter_pushdown:: { FilterPushdownPhase , PushedDown } ;
3132use datafusion_physical_plan:: {
3233 displayable,
@@ -62,12 +63,6 @@ impl FileOpener for TestOpener {
6263 _file_meta : FileMeta ,
6364 _file : PartitionedFile ,
6465 ) -> Result < FileOpenFuture > {
65- if let Some ( predicate) = & self . predicate {
66- println ! (
67- "Predicate when calling open: {}" ,
68- fmt_sql( predicate. as_ref( ) )
69- ) ;
70- }
7166 let mut batches = self . batches . clone ( ) ;
7267 if let Some ( batch_size) = self . batch_size {
7368 let batch = concat_batches ( & batches[ 0 ] . schema ( ) , & batches) ?;
@@ -84,6 +79,12 @@ impl FileOpener for TestOpener {
8479 let ( mapper, projection) = factory. map_schema ( & batches[ 0 ] . schema ( ) ) . unwrap ( ) ;
8580 let mut new_batches = Vec :: new ( ) ;
8681 for batch in batches {
82+ let batch = if let Some ( predicate) = & self . predicate {
83+ batch_filter ( & batch, predicate) ?
84+ } else {
85+ batch
86+ } ;
87+
8788 let batch = batch. project ( & projection) . unwrap ( ) ;
8889 let batch = mapper. map_batch ( batch) . unwrap ( ) ;
8990 new_batches. push ( batch) ;
0 commit comments