diff --git a/examples/parquet_read.rs b/examples/parquet_read.rs index a296c73c249..fa0a769d443 100644 --- a/examples/parquet_read.rs +++ b/examples/parquet_read.rs @@ -20,10 +20,11 @@ fn main() -> Result<(), Error> { // we can filter the columns we need (here we select all) let schema = schema.filter(|_index, _field| true); - // we can read the statistics of all parquet's row groups (here for the first field) - let statistics = read::statistics::deserialize(&schema.fields[0], &metadata.row_groups)?; - - println!("{:#?}", statistics); + // we can read the statistics of all parquet's row groups (here for each field) + for field in &schema.fields { + let statistics = read::statistics::deserialize(field, &metadata.row_groups)?; + println!("{:#?}", statistics); + } // say we found that we only need to read the first two row groups, "0" and "1" let row_groups = metadata diff --git a/src/io/parquet/read/statistics/list.rs b/src/io/parquet/read/statistics/list.rs index 496c7deb9d3..9d0adbcb0cc 100644 --- a/src/io/parquet/read/statistics/list.rs +++ b/src/io/parquet/read/statistics/list.rs @@ -40,7 +40,7 @@ impl MutableArray for DynMutableListArray { match self.data_type.to_logical_type() { DataType::List(_) => { - let offsets = vec![0, inner.len() as i32].into(); + let offsets = (0..=inner.len() as i32).collect::>().into(); Box::new(ListArray::::new( self.data_type.clone(), offsets, @@ -49,7 +49,7 @@ impl MutableArray for DynMutableListArray { )) } DataType::LargeList(_) => { - let offsets = vec![0, inner.len() as i64].into(); + let offsets = (0..=inner.len() as i64).collect::>().into(); Box::new(ListArray::::new( self.data_type.clone(), offsets,