@@ -17,9 +17,7 @@ use datafusion_physical_expr_adapter::{
1717 DefaultPhysicalExprAdapterFactory , PhysicalExprAdapterFactory ,
1818} ;
1919use datafusion_physical_expr_common:: physical_expr:: fmt_sql;
20- use datafusion_physical_plan:: filter_pushdown:: {
21- FilterPushdownPropagation , PushedDown , PushedDownPredicate ,
22- } ;
20+ use datafusion_physical_plan:: filter_pushdown:: { FilterPushdownPropagation , PushedDown } ;
2321use datafusion_physical_plan:: metrics:: ExecutionPlanMetricsSet ;
2422use datafusion_physical_plan:: { DisplayFormatType , PhysicalExpr } ;
2523use object_store:: ObjectStore ;
@@ -45,10 +43,7 @@ pub struct VortexSource {
4543 pub ( crate ) file_cache : VortexFileCache ,
4644 /// Combined predicate expression containing all filters from DataFusion query planning.
4745 /// Used with FilePruner to skip files based on statistics and partition values.
48- pub ( crate ) full_predicate : Option < PhysicalExprRef > ,
49- /// Subset of predicates that can be pushed down into Vortex scan operations.
50- /// These are expressions that Vortex can efficiently evaluate during scanning.
51- pub ( crate ) vortex_predicate : Option < PhysicalExprRef > ,
46+ pub ( crate ) predicate : Option < PhysicalExprRef > ,
5247 pub ( crate ) batch_size : Option < usize > ,
5348 pub ( crate ) projected_statistics : Option < Statistics > ,
5449 /// This is the file schema the table expects, which is the table's schema without partition columns, and **not** the file's physical schema.
@@ -67,8 +62,7 @@ impl VortexSource {
6762 Self {
6863 session,
6964 file_cache,
70- full_predicate : None ,
71- vortex_predicate : None ,
65+ predicate : None ,
7266 batch_size : None ,
7367 projected_statistics : None ,
7468 arrow_file_schema : None ,
@@ -140,8 +134,8 @@ impl FileSource for VortexSource {
140134 session : self . session . clone ( ) ,
141135 object_store,
142136 projection,
143- filter : self . vortex_predicate . clone ( ) ,
144- file_pruning_predicate : self . full_predicate . clone ( ) ,
137+
138+ predicate : self . predicate . clone ( ) ,
145139 expr_adapter_factory,
146140 schema_adapter_factory,
147141 partition_fields : base_config. table_partition_cols . clone ( ) ,
@@ -184,7 +178,7 @@ impl FileSource for VortexSource {
184178 }
185179
186180 fn filter ( & self ) -> Option < Arc < dyn PhysicalExpr > > {
187- self . vortex_predicate . clone ( )
181+ self . predicate . clone ( )
188182 }
189183
190184 fn metrics ( & self ) -> & ExecutionPlanMetricsSet {
@@ -197,7 +191,7 @@ impl FileSource for VortexSource {
197191 . clone ( )
198192 . vortex_expect ( "projected_statistics must be set" ) ;
199193
200- if self . vortex_predicate . is_some ( ) {
194+ if self . predicate . is_some ( ) {
201195 Ok ( statistics. to_inexact ( ) )
202196 } else {
203197 Ok ( statistics)
@@ -211,13 +205,13 @@ impl FileSource for VortexSource {
211205 fn fmt_extra ( & self , t : DisplayFormatType , f : & mut Formatter ) -> std:: fmt:: Result {
212206 match t {
213207 DisplayFormatType :: Default | DisplayFormatType :: Verbose => {
214- if let Some ( ref predicate) = self . vortex_predicate {
208+ if let Some ( ref predicate) = self . predicate {
215209 write ! ( f, ", predicate: {predicate}" ) ?;
216210 }
217211 }
218212 // Use TreeRender style key=value formatting to display the predicate
219213 DisplayFormatType :: TreeRender => {
220- if let Some ( ref predicate) = self . vortex_predicate {
214+ if let Some ( ref predicate) = self . predicate {
221215 writeln ! ( f, "predicate={}" , fmt_sql( predicate. as_ref( ) ) ) ?;
222216 } ;
223217 }
@@ -238,57 +232,29 @@ impl FileSource for VortexSource {
238232
239233 let mut source = self . clone ( ) ;
240234
241- // Combine new filters with existing predicate for file pruning.
242- // This full predicate is used by FilePruner to eliminate files.
243- source. full_predicate = match source. full_predicate {
244- Some ( predicate) => Some ( conjunction (
245- std:: iter:: once ( predicate) . chain ( filters. clone ( ) ) ,
246- ) ) ,
247- None => Some ( conjunction ( filters. clone ( ) ) ) ,
248- } ;
249-
250- let supported_filters = filters
251- . into_iter ( )
235+ let supported = filters
236+ . iter ( )
252237 . map ( |expr| {
253- if can_be_pushed_down ( & expr, schema) {
254- PushedDownPredicate :: supported ( expr )
238+ if can_be_pushed_down ( expr, schema) {
239+ PushedDown :: Yes
255240 } else {
256- PushedDownPredicate :: unsupported ( expr )
241+ PushedDown :: No
257242 }
258243 } )
259244 . collect :: < Vec < _ > > ( ) ;
260245
261- if supported_filters
262- . iter ( )
263- . all ( |p| matches ! ( p. discriminant, PushedDown :: No ) )
264- {
265- return Ok ( FilterPushdownPropagation :: with_parent_pushdown_result (
266- vec ! [ PushedDown :: No ; supported_filters. len( ) ] ,
267- )
268- . with_updated_node ( Arc :: new ( source) as _ ) ) ;
269- }
270-
271- let supported = supported_filters
272- . iter ( )
273- . filter_map ( |p| match p. discriminant {
274- PushedDown :: Yes => Some ( & p. predicate ) ,
275- PushedDown :: No => None ,
276- } )
277- . cloned ( ) ;
278-
279- let predicate = match source. vortex_predicate {
280- Some ( predicate) => conjunction ( std:: iter:: once ( predicate) . chain ( supported) ) ,
281- None => conjunction ( supported) ,
246+ // Combine new filters with existing predicate
247+ source. predicate = match source. predicate {
248+ Some ( predicate) => Some ( conjunction (
249+ std:: iter:: once ( predicate) . chain ( filters. clone ( ) ) ,
250+ ) ) ,
251+ None => Some ( conjunction ( filters. clone ( ) ) ) ,
282252 } ;
283253
284- tracing:: debug!( %predicate, "Saving predicate" ) ;
285-
286- source. vortex_predicate = Some ( predicate) ;
287-
288- Ok ( FilterPushdownPropagation :: with_parent_pushdown_result (
289- supported_filters. iter ( ) . map ( |f| f. discriminant ) . collect ( ) ,
254+ Ok (
255+ FilterPushdownPropagation :: with_parent_pushdown_result ( supported)
256+ . with_updated_node ( Arc :: new ( source) as _ ) ,
290257 )
291- . with_updated_node ( Arc :: new ( source) as _ ) )
292258 }
293259
294260 fn with_schema_adapter_factory (
0 commit comments