@@ -149,7 +149,9 @@ pub fn parquet_to_datafile(
149149 }
150150 }
151151 }
152- if let Some ( max_bytes) = statistics. max_bytes_opt ( ) {
152+ }
153+ if let Some ( max_bytes) = statistics. max_bytes_opt ( ) {
154+ if let Type :: Primitive ( _) = & data_type {
153155 let new = Value :: try_from_bytes ( max_bytes, data_type) ?;
154156 match upper_bounds. entry ( id) {
155157 Entry :: Occupied ( mut entry) => {
@@ -202,30 +204,28 @@ pub fn parquet_to_datafile(
202204 entry. insert ( new) ;
203205 }
204206 }
207+ }
208+ }
205209
206- if let Some ( partition_field) = partition_fields. get ( column_name) {
207- if let Some ( partition_value) = partition. get_mut ( partition_field. name ( ) )
210+ if let Some ( partition_field) = partition_fields. get ( column_name) {
211+ if let Some ( partition_value) = partition. get_mut ( partition_field. name ( ) ) {
212+ if partition_value. is_none ( ) {
213+ let partition_field = partition_fields
214+ . get ( column_name)
215+ . ok_or_else ( || Error :: InvalidFormat ( "transform" . to_string ( ) ) ) ?;
216+ if let ( Some ( min_bytes) , Some ( max_bytes) ) =
217+ ( statistics. min_bytes_opt ( ) , statistics. max_bytes_opt ( ) )
208218 {
209- if partition_value. is_none ( ) {
210- let partition_field =
211- partition_fields. get ( column_name) . ok_or_else ( || {
212- Error :: InvalidFormat ( "transform" . to_string ( ) )
213- } ) ?;
214- if let ( Some ( min_bytes) , Some ( max_bytes) ) =
215- ( statistics. min_bytes_opt ( ) , statistics. max_bytes_opt ( ) )
216- {
217- let min = Value :: try_from_bytes ( min_bytes, data_type) ?
218- . transform ( partition_field. transform ( ) ) ?;
219- let max = Value :: try_from_bytes ( max_bytes, data_type) ?
220- . transform ( partition_field. transform ( ) ) ?;
221- if min == max {
222- * partition_value = Some ( min)
223- } else {
224- return Err ( Error :: InvalidFormat (
225- "Partition value of data file" . to_owned ( ) ,
226- ) ) ;
227- }
228- }
219+ let min = Value :: try_from_bytes ( min_bytes, data_type) ?
220+ . transform ( partition_field. transform ( ) ) ?;
221+ let max = Value :: try_from_bytes ( max_bytes, data_type) ?
222+ . transform ( partition_field. transform ( ) ) ?;
223+ if min == max {
224+ * partition_value = Some ( min)
225+ } else {
226+ return Err ( Error :: InvalidFormat (
227+ "Partition value of data file" . to_owned ( ) ,
228+ ) ) ;
229229 }
230230 }
231231 }
0 commit comments