alamb commented on a change in pull request #9064: URL: https://github.com/apache/arrow/pull/9064#discussion_r558505683
########## File path: rust/datafusion/src/physical_plan/parquet.rs ########## @@ -950,9 +944,88 @@ mod tests { .downcast_ref::<Int32Array>() .unwrap(); let int32_vec = int32_array.into_iter().collect::<Vec<_>>(); + // here the first max value is None and not the Some(10) value which was actually set + // because the min value is None assert_eq!(int32_vec, vec![None, Some(20), Some(30)]); } + #[test] + fn build_statistics_array_utf8() { + // build row group metadata array + let s1 = ParquetStatistics::byte_array(None, Some("10".into()), None, 0, false); + let s2 = ParquetStatistics::byte_array( + Some("2".into()), + Some("20".into()), + None, + 0, + false, + ); + let s3 = ParquetStatistics::byte_array( + Some("3".into()), + Some("30".into()), + None, + 0, + false, + ); + let statistics = vec![Some(&s1), Some(&s2), Some(&s3)]; + + let statistics_array = + build_statistics_array(&statistics, StatisticsType::Min, &DataType::Utf8); + let string_array = statistics_array + .as_any() + .downcast_ref::<StringArray>() + .unwrap(); + let string_vec = string_array.into_iter().collect::<Vec<_>>(); + assert_eq!(string_vec, vec![None, Some("2"), Some("3")]); + + let statistics_array = + build_statistics_array(&statistics, StatisticsType::Max, &DataType::Utf8); + let string_array = statistics_array + .as_any() + .downcast_ref::<StringArray>() + .unwrap(); + let string_vec = string_array.into_iter().collect::<Vec<_>>(); + // here the first max value is None and not the Some("10") value which was actually set Review comment: 👍 ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org