@@ -336,6 +336,7 @@ impl ParquetSource {
336
336
}
337
337
338
338
/// Optional predicate.
339
+ #[ deprecated( since = "50.2.0" , note = "use `filter` instead" ) ]
339
340
pub fn predicate ( & self ) -> Option < & Arc < dyn PhysicalExpr > > {
340
341
self . predicate . as_ref ( )
341
342
}
@@ -631,7 +632,7 @@ impl FileSource for ParquetSource {
631
632
// (bloom filters use `pruning_predicate` too).
632
633
// Because filter pushdown may happen dynamically as long as there is a predicate
633
634
// if we have *any* predicate applied, we can't guarantee the statistics are exact.
634
- if self . predicate ( ) . is_some ( ) {
635
+ if self . filter ( ) . is_some ( ) {
635
636
Ok ( statistics. to_inexact ( ) )
636
637
} else {
637
638
Ok ( statistics)
@@ -646,7 +647,7 @@ impl FileSource for ParquetSource {
646
647
match t {
647
648
DisplayFormatType :: Default | DisplayFormatType :: Verbose => {
648
649
let predicate_string = self
649
- . predicate ( )
650
+ . filter ( )
650
651
. map ( |p| format ! ( ", predicate={p}" ) )
651
652
. unwrap_or_default ( ) ;
652
653
@@ -686,7 +687,7 @@ impl FileSource for ParquetSource {
686
687
Ok ( ( ) )
687
688
}
688
689
DisplayFormatType :: TreeRender => {
689
- if let Some ( predicate) = self . predicate ( ) {
690
+ if let Some ( predicate) = self . filter ( ) {
690
691
writeln ! ( f, "predicate={}" , fmt_sql( predicate. as_ref( ) ) ) ?;
691
692
}
692
693
Ok ( ( ) )
@@ -780,3 +781,19 @@ impl FileSource for ParquetSource {
780
781
self . schema_adapter_factory . clone ( )
781
782
}
782
783
}
784
+
785
+ #[ cfg( test) ]
786
+ mod tests {
787
+ use super :: * ;
788
+ use datafusion_physical_expr:: expressions:: lit;
789
+
790
+ #[ test]
791
+ #[ allow( deprecated) ]
792
+ fn test_parquet_source_predicate_same_as_filter ( ) {
793
+ let predicate = lit ( true ) ;
794
+
795
+ let parquet_source = ParquetSource :: default ( ) . with_predicate ( predicate) ;
796
+ // same value. but filter() call Arc::clone internally
797
+ assert_eq ! ( parquet_source. predicate( ) , parquet_source. filter( ) . as_ref( ) ) ;
798
+ }
799
+ }
0 commit comments