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

Commit

Permalink
Made StructIterator and NestedArrayIter public (#1385)
Browse files Browse the repository at this point in the history
  • Loading branch information
b41sh committed Feb 9, 2023
1 parent 6a05c6b commit 7396c1f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/io/parquet/read/deserialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use crate::{
};

pub use self::nested_utils::{init_nested, InitNested, NestedArrayIter, NestedState};
pub use self::struct_::StructIterator;
use simple::page_iter_to_arrays;

use super::*;
Expand Down
1 change: 1 addition & 0 deletions src/io/parquet/read/deserialize/nested_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,5 +556,6 @@ where
}
}

/// Type def for a sharable, boxed dyn [`Iterator`] of NestedStates and arrays
pub type NestedArrayIter<'a> =
Box<dyn Iterator<Item = Result<(NestedState, Box<dyn Array>)>> + Send + Sync + 'a>;
2 changes: 2 additions & 0 deletions src/io/parquet/read/deserialize/struct_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ use crate::error::Error;

use super::nested_utils::{NestedArrayIter, NestedState};

/// An iterator adapter over [`NestedArrayIter`] assumed to be encoded as Struct arrays
pub struct StructIterator<'a> {
iters: Vec<NestedArrayIter<'a>>,
fields: Vec<Field>,
}

impl<'a> StructIterator<'a> {
/// Creates a new [`StructIterator`] with `iters` and `fields`.
pub fn new(iters: Vec<NestedArrayIter<'a>>, fields: Vec<Field>) -> Self {
assert_eq!(iters.len(), fields.len());
Self { iters, fields }
Expand Down
2 changes: 1 addition & 1 deletion src/io/parquet/read/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use crate::{array::Array, error::Result};

pub use deserialize::{
column_iter_to_arrays, create_list, get_page_iterator, init_nested, n_columns, InitNested,
NestedState,
NestedArrayIter, NestedState, StructIterator,
};
pub use file::{FileReader, RowGroupReader};
pub use row_group::*;
Expand Down

0 comments on commit 7396c1f

Please sign in to comment.