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

Commit

Permalink
Fixed edge case in reading multiple parquet pages (#904)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao authored Mar 12, 2022
1 parent 4b893b7 commit 70d7a3d
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 140 deletions.
15 changes: 11 additions & 4 deletions src/io/parquet/read/deserialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,27 @@ fn create_list(
) -> Result<Arc<dyn Array>> {
Ok(match data_type {
DataType::List(_) => {
let (offsets, validity) = nested.nested.pop().unwrap().inner();
let (mut offsets, validity) = nested.nested.pop().unwrap().inner();
offsets.push(values.len() as i64);

let offsets = offsets.iter().map(|x| *x as i32).collect::<Vec<_>>();
Arc::new(ListArray::<i32>::new(
data_type,
offsets.into(),
values,
validity,
validity.and_then(|x| x.into()),
))
}
DataType::LargeList(_) => {
let (offsets, validity) = nested.nested.pop().unwrap().inner();
let (mut offsets, validity) = nested.nested.pop().unwrap().inner();
offsets.push(values.len() as i64);

Arc::new(ListArray::<i64>::new(data_type, offsets, values, validity))
Arc::new(ListArray::<i64>::new(
data_type,
offsets.into(),
values,
validity.and_then(|x| x.into()),
))
}
_ => {
return Err(ArrowError::NotYetImplemented(format!(
Expand Down
Loading

0 comments on commit 70d7a3d

Please sign in to comment.