@@ -336,6 +336,7 @@ impl ParquetSource {
336336 }
337337
338338 /// Optional predicate.
339+ #[ deprecated( since = "50.2.0" , note = "use `filter` instead" ) ]
339340 pub fn predicate ( & self ) -> Option < & Arc < dyn PhysicalExpr > > {
340341 self . predicate . as_ref ( )
341342 }
@@ -631,7 +632,7 @@ impl FileSource for ParquetSource {
631632 // (bloom filters use `pruning_predicate` too).
632633 // Because filter pushdown may happen dynamically as long as there is a predicate
633634 // 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 ( ) {
635636 Ok ( statistics. to_inexact ( ) )
636637 } else {
637638 Ok ( statistics)
@@ -646,7 +647,7 @@ impl FileSource for ParquetSource {
646647 match t {
647648 DisplayFormatType :: Default | DisplayFormatType :: Verbose => {
648649 let predicate_string = self
649- . predicate ( )
650+ . filter ( )
650651 . map ( |p| format ! ( ", predicate={p}" ) )
651652 . unwrap_or_default ( ) ;
652653
@@ -686,7 +687,7 @@ impl FileSource for ParquetSource {
686687 Ok ( ( ) )
687688 }
688689 DisplayFormatType :: TreeRender => {
689- if let Some ( predicate) = self . predicate ( ) {
690+ if let Some ( predicate) = self . filter ( ) {
690691 writeln ! ( f, "predicate={}" , fmt_sql( predicate. as_ref( ) ) ) ?;
691692 }
692693 Ok ( ( ) )
@@ -780,3 +781,19 @@ impl FileSource for ParquetSource {
780781 self . schema_adapter_factory . clone ( )
781782 }
782783}
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