@@ -166,7 +166,6 @@ impl FileOpener for ParquetOpener {
166166 . global_counter ( "num_predicate_creation_errors" ) ;
167167
168168 let expr_adapter_factory = self . expr_adapter_factory . clone ( ) ;
169- let partition_fields = self . table_schema . table_partition_cols ( ) . to_vec ( ) ;
170169 let mut predicate_file_schema = Arc :: clone ( self . table_schema . file_schema ( ) ) ;
171170
172171 let enable_page_index = self . enable_page_index ;
@@ -191,7 +190,7 @@ impl FileOpener for ParquetOpener {
191190 let mut file_pruner = predicate
192191 . as_ref ( )
193192 . filter ( |p| {
194- is_dynamic_physical_expr ( p) || partitioned_file. has_statistics ( )
193+ is_dynamic_physical_expr ( p) && partitioned_file. has_statistics ( )
195194 } )
196195 . and_then ( |p| {
197196 FilePruner :: try_new (
@@ -1241,15 +1240,15 @@ mod test {
12411240 }
12421241 } ;
12431242
1244- // // This filter could prune based on statistics, but since it's not dynamic it's not applied for pruning
1245- // // (the assumption is this happened already at planning time)
1246- let expr = col ( "a" ) . eq ( lit ( 42 ) ) . and ( col ( "part" ) . eq ( lit ( 1 ) ) ) ;
1247- // let predicate = logical2physical(&expr, &table_schema);
1248- // let opener = make_opener(predicate);
1249- // let stream = opener.open(file.clone()).unwrap().await.unwrap();
1250- // let (num_batches, num_rows) = count_batches_and_rows(stream).await;
1251- // assert_eq!(num_batches, 1);
1252- // assert_eq!(num_rows, 3);
1243+ // This filter could prune based on statistics, but since it's not dynamic it's not applied for pruning
1244+ // (the assumption is this happened already at planning time)
1245+ let expr = col ( "a" ) . eq ( lit ( 42 ) ) ;
1246+ let predicate = logical2physical ( & expr, & table_schema) ;
1247+ let opener = make_opener ( predicate) ;
1248+ let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
1249+ let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
1250+ assert_eq ! ( num_batches, 1 ) ;
1251+ assert_eq ! ( num_rows, 3 ) ;
12531252
12541253 // If we make the filter dynamic, it should prune.
12551254 // This allows dynamic filters to prune partitions/files even if they are populated late into execution.
0 commit comments