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

Commit

Permalink
Applied suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Feb 14, 2023
1 parent c1b94e8 commit ef34171
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/io/parquet/read/deserialize/binary/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,28 +311,28 @@ impl<'a, O: Offset> utils::Decoder<'a> for BinaryDecoder<O> {
// this is an upper bound - we may not consume the whole page.
// we do not know how many nulls are there, so we do not know how many
// valid items are there to discount over the sequence.
Binary::<O>::with_capacity(capacity, values.num_bytes()),
Binary::<O>::with_capacity(capacity, Some(values.num_bytes())),
MutableBitmap::with_capacity(capacity),
),
State::Required(values) => (
// this is an upper bound - we may not consume the whole page.
Binary::<O>::with_capacity(capacity, values.values.num_bytes()),
Binary::<O>::with_capacity(capacity, Some(values.values.num_bytes())),
MutableBitmap::new(),
),
State::FilteredRequiredDictionary(_)
| State::FilteredRequired(_)
| State::RequiredDictionary(_)
| State::Delta(_)
| State::FilteredDelta(_) => (
Binary::<O>::with_capacity(capacity, 0),
Binary::<O>::with_capacity(capacity, None),
MutableBitmap::new(),
),
State::FilteredOptionalDictionary(_, _)
| State::FilteredOptional(_, _)
| State::OptionalDictionary(_, _)
| State::OptionalDelta(_, _)
| State::FilteredOptionalDelta(_, _) => (
Binary::<O>::with_capacity(capacity, 0),
Binary::<O>::with_capacity(capacity, None),
MutableBitmap::with_capacity(capacity),
),
}
Expand Down
2 changes: 1 addition & 1 deletion src/io/parquet/read/deserialize/binary/dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fn read_dict<O: Offset>(data_type: DataType, dict: &DictPage) -> Box<dyn Array>

let values = SizedBinaryIter::new(&dict.buffer, dict.num_values);

let mut data = Binary::<O>::with_capacity(dict.num_values, 0);
let mut data = Binary::<O>::with_capacity(dict.num_values, None);
data.values = Vec::with_capacity(dict.buffer.len() - 4 * dict.num_values);
for item in values {
data.push(item)
Expand Down
2 changes: 1 addition & 1 deletion src/io/parquet/read/deserialize/binary/nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl<'a, O: Offset> NestedDecoder<'a> for BinaryDecoder<O> {

fn with_capacity(&self, capacity: usize) -> Self::DecodedState {
(
Binary::<O>::with_capacity(capacity, 0),
Binary::<O>::with_capacity(capacity, None),
MutableBitmap::with_capacity(capacity),
)
}
Expand Down
3 changes: 2 additions & 1 deletion src/io/parquet/read/deserialize/binary/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ impl<O: Offset> Pushable<usize> for Offsets<O> {

impl<O: Offset> Binary<O> {
#[inline]
pub fn with_capacity(capacity: usize, values_capacity: usize) -> Self {
pub fn with_capacity(capacity: usize, values_capacity: Option<usize>) -> Self {
let values_capacity = values_capacity.unwrap_or(capacity.min(100) * 24);
Self {
offsets: Offsets::with_capacity(capacity),
values: Vec::with_capacity(values_capacity),
Expand Down

0 comments on commit ef34171

Please sign in to comment.