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

Fixed reading nested stats #1240

Merged
merged 1 commit into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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