alamb commented on code in PR #10715:
URL: https://github.com/apache/datafusion/pull/10715#discussion_r1619383361
##########
datafusion/core/src/datasource/physical_plan/parquet/statistics.rs:
##########
@@ -211,9 +287,29 @@ pub(crate) fn min_statistics<'a, I: Iterator<Item =
Option<&'a ParquetStatistics
data_type: &DataType,
iterator: I,
) -> Result<ArrayRef> {
- let scalars = iterator
- .map(|x| x.and_then(|s| get_statistic!(s, min, min_bytes,
Some(data_type))));
- collect_scalars(data_type, scalars)
+ match data_type {
Review Comment:
Here is an example of how they work -- you make
`BoolStatsIterator::new(iterator)` which then returns a sequence of
`Option<&bool>` and then the min/max can be extracted out
##########
datafusion/core/src/datasource/physical_plan/parquet/statistics.rs:
##########
@@ -52,6 +55,79 @@ fn sign_extend_be(b: &[u8]) -> [u8; 16] {
result
}
+/// Define an adapter iterator for extracting statistics from an iterator of
+/// `ParquetStatistics`
+///
+/// Handles checking if the statistics are present and valid with the correct
type
+///
+/// Parameters:
+/// * `$iterator_type` is the name of the iterator type (e.g.
`BoolStatsIterator`)
+/// * `$parquet_statistics_type` is the type of the statistics (e.g.
`ParquetStatistics::Boolean`)
+/// * `$stat_value_type` is the type of the statistics value (e.g. `bool`)
+macro_rules! make_stats_iterator {
Review Comment:
Here is an idea to create structs like `BoolStatsIterator` which will return
an iterator of `Option<ValueStatstics<bool>>` and do the validitiy / type
checking
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]