Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Fixed reading nested stats
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Sep 2, 2022
1 parent cd51b66 commit bde8fb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions examples/parquet_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/io/parquet/read/statistics/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>().into();
Box::new(ListArray::<i32>::new(
self.data_type.clone(),
offsets,
Expand All @@ -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::<Vec<_>>().into();
Box::new(ListArray::<i64>::new(
self.data_type.clone(),
offsets,
Expand Down

0 comments on commit bde8fb9

Please sign in to comment.