kylebarron commented on code in PR #8225: URL: https://github.com/apache/arrow-rs/pull/8225#discussion_r2299702474
########## parquet/src/geospatial/statistics.rs: ########## @@ -178,15 +197,26 @@ pub fn from_thrift(geo_statistics: Option<TGeospatialStatistics>) -> Result<Opti Ok(match geo_statistics { Some(geo_stats) => { let bbox = if let Some(bbox) = geo_stats.bbox { - Some(BoundingBox::new( - bbox.xmin.into(), - bbox.ymin.into(), - bbox.xmax.into(), - bbox.ymax.into(), - if let Some(zmin) = bbox.zmin { Some(zmin.into()) } else { None }, - if let Some(zmax) = bbox.zmax { Some(zmax.into()) } else { None }, - if let Some(mmin) = bbox.mmin { Some(mmin.into()) } else { None }, - if let Some(mmax) = bbox.mmax { Some(mmax.into()) } else { None })) + let mut new_bbox = BoundingBox::new( + bbox.xmin.into(), + bbox.ymin.into(), + bbox.xmax.into(), + bbox.ymax.into(), + ); + + if bbox.zmin.is_some() && bbox.zmax.is_some() { + new_bbox = new_bbox.with_zrange(bbox.zmin.unwrap().into(), bbox.zmax.unwrap().into()); + } else if bbox.zmin.is_some() != bbox.zmax.is_some() { + return Err(ParquetError::General(format!("Z-coordinate values mismatch: {:?} and {:?}", bbox.zmin, bbox.zmax))); + } Review Comment: Up to you but maybe slightly easier to read if you `match (bbox.zmin, bbox.zmax)` instead of having these two `if` clauses. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org