File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,29 +81,25 @@ pub(crate) fn init_datasource_exec(
8181 encryption_enabled,
8282 ) ;
8383
84+ dbg ! ( & required_schema, & data_schema) ;
85+
8486 // Determine the schema to use for ParquetSource
85- let table_schema = if let Some ( ref data_schema) = data_schema {
86- if let Some ( ref partition_schema) = partition_schema {
87- let partition_fields: Vec < _ > = partition_schema
88- . fields ( )
89- . iter ( )
90- . map ( |f| {
91- Arc :: new ( Field :: new ( f. name ( ) , f. data_type ( ) . clone ( ) , f. is_nullable ( ) ) ) as _
92- } )
93- . collect ( ) ;
94- TableSchema :: new ( Arc :: clone ( data_schema) , partition_fields)
95- } else {
96- TableSchema :: from_file_schema ( Arc :: clone ( data_schema) )
97- }
98- } else {
99- TableSchema :: from_file_schema ( Arc :: clone ( & required_schema) )
100- } ;
87+ let base_schema = required_schema. clone ( ) ;
88+ let partition_fields: Vec < _ > = partition_schema
89+ . iter ( )
90+ . flat_map ( |s| s. fields ( ) . iter ( ) )
91+ . map ( |f| Arc :: new ( Field :: new ( f. name ( ) , f. data_type ( ) . clone ( ) , f. is_nullable ( ) ) ) as _ )
92+ . collect ( ) ;
93+ let table_schema =
94+ TableSchema :: from_file_schema ( base_schema) . with_table_partition_cols ( partition_fields) ;
10195
102- dbg ! ( & table_schema) ;
96+ // dbg!(&table_schema);
10397
10498 let mut parquet_source =
10599 ParquetSource :: new ( table_schema) . with_table_parquet_options ( table_parquet_options) ;
106100
101+ dbg ! ( & parquet_source) ;
102+
107103 // Create a conjunctive form of the vector because ParquetExecBuilder takes
108104 // a single expression
109105 if let Some ( data_filters) = data_filters {
You can’t perform that action at this time.
0 commit comments