@@ -24,7 +24,7 @@ use std::sync::Arc;
24
24
use crate :: datasource:: listing:: PartitionedFile ;
25
25
use crate :: datasource:: physical_plan:: file_stream:: FileStream ;
26
26
use crate :: datasource:: physical_plan:: {
27
- parquet:: page_filter:: PagePruningPredicate , DisplayAs , FileGroupPartitioner ,
27
+ parquet:: page_filter:: PagePruningAccessPlanFilter , DisplayAs , FileGroupPartitioner ,
28
28
FileScanConfig ,
29
29
} ;
30
30
use crate :: {
@@ -39,13 +39,11 @@ use crate::{
39
39
} ,
40
40
} ;
41
41
42
- use arrow:: datatypes:: { DataType , SchemaRef } ;
42
+ use arrow:: datatypes:: SchemaRef ;
43
43
use datafusion_physical_expr:: { EquivalenceProperties , LexOrdering , PhysicalExpr } ;
44
44
45
45
use itertools:: Itertools ;
46
46
use log:: debug;
47
- use parquet:: basic:: { ConvertedType , LogicalType } ;
48
- use parquet:: schema:: types:: ColumnDescriptor ;
49
47
50
48
mod access_plan;
51
49
mod metrics;
@@ -225,7 +223,7 @@ pub struct ParquetExec {
225
223
/// Optional predicate for pruning row groups (derived from `predicate`)
226
224
pruning_predicate : Option < Arc < PruningPredicate > > ,
227
225
/// Optional predicate for pruning pages (derived from `predicate`)
228
- page_pruning_predicate : Option < Arc < PagePruningPredicate > > ,
226
+ page_pruning_predicate : Option < Arc < PagePruningAccessPlanFilter > > ,
229
227
/// Optional hint for the size of the parquet metadata
230
228
metadata_size_hint : Option < usize > ,
231
229
/// Optional user defined parquet file reader factory
@@ -381,19 +379,12 @@ impl ParquetExecBuilder {
381
379
} )
382
380
. filter ( |p| !p. always_true ( ) ) ;
383
381
384
- let page_pruning_predicate = predicate. as_ref ( ) . and_then ( |predicate_expr| {
385
- match PagePruningPredicate :: try_new ( predicate_expr, file_schema. clone ( ) ) {
386
- Ok ( pruning_predicate) => Some ( Arc :: new ( pruning_predicate) ) ,
387
- Err ( e) => {
388
- debug ! (
389
- "Could not create page pruning predicate for '{:?}': {}" ,
390
- pruning_predicate, e
391
- ) ;
392
- predicate_creation_errors. add ( 1 ) ;
393
- None
394
- }
395
- }
396
- } ) ;
382
+ let page_pruning_predicate = predicate
383
+ . as_ref ( )
384
+ . map ( |predicate_expr| {
385
+ PagePruningAccessPlanFilter :: new ( predicate_expr, file_schema. clone ( ) )
386
+ } )
387
+ . map ( Arc :: new) ;
397
388
398
389
let ( projected_schema, projected_statistics, projected_output_ordering) =
399
390
base_config. project ( ) ;
@@ -739,7 +730,7 @@ impl ExecutionPlan for ParquetExec {
739
730
740
731
fn should_enable_page_index (
741
732
enable_page_index : bool ,
742
- page_pruning_predicate : & Option < Arc < PagePruningPredicate > > ,
733
+ page_pruning_predicate : & Option < Arc < PagePruningAccessPlanFilter > > ,
743
734
) -> bool {
744
735
enable_page_index
745
736
&& page_pruning_predicate. is_some ( )
@@ -749,26 +740,6 @@ fn should_enable_page_index(
749
740
. unwrap_or ( false )
750
741
}
751
742
752
- // Convert parquet column schema to arrow data type, and just consider the
753
- // decimal data type.
754
- pub ( crate ) fn parquet_to_arrow_decimal_type (
755
- parquet_column : & ColumnDescriptor ,
756
- ) -> Option < DataType > {
757
- let type_ptr = parquet_column. self_type_ptr ( ) ;
758
- match type_ptr. get_basic_info ( ) . logical_type ( ) {
759
- Some ( LogicalType :: Decimal { scale, precision } ) => {
760
- Some ( DataType :: Decimal128 ( precision as u8 , scale as i8 ) )
761
- }
762
- _ => match type_ptr. get_basic_info ( ) . converted_type ( ) {
763
- ConvertedType :: DECIMAL => Some ( DataType :: Decimal128 (
764
- type_ptr. get_precision ( ) as u8 ,
765
- type_ptr. get_scale ( ) as i8 ,
766
- ) ) ,
767
- _ => None ,
768
- } ,
769
- }
770
- }
771
-
772
743
#[ cfg( test) ]
773
744
mod tests {
774
745
// See also `parquet_exec` integration test
@@ -798,7 +769,7 @@ mod tests {
798
769
} ;
799
770
use arrow:: datatypes:: { Field , Schema , SchemaBuilder } ;
800
771
use arrow:: record_batch:: RecordBatch ;
801
- use arrow_schema:: Fields ;
772
+ use arrow_schema:: { DataType , Fields } ;
802
773
use datafusion_common:: { assert_contains, ScalarValue } ;
803
774
use datafusion_expr:: { col, lit, when, Expr } ;
804
775
use datafusion_physical_expr:: planner:: logical2physical;
0 commit comments