Skip to content

Commit

Permalink
refactor(parquet): coercion logic & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-brobot committed Apr 18, 2024
1 parent 169de0f commit aa03bb7
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions parquet/src/arrow/arrow_writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,13 +830,8 @@ fn to_boolean_mask(indices: &[usize], len: usize) -> BooleanArray {
fn to_flb_arrays(array: &FixedSizeBinaryArray) -> Vec<FixedLenByteArray> {
array
.iter()
.map(|x| {
if x.is_some() {
FixedLenByteArray::from(Vec::from(x.unwrap()))
} else {
FixedLenByteArray::default()
}
})
.map(|x| x.map(Vec::from))
.map(|x| x.map_or_else(FixedLenByteArray::default, FixedLenByteArray::from))
.collect()
}

Expand Down Expand Up @@ -2071,15 +2066,15 @@ mod tests {
let many_vecs: Vec<_> = std::iter::repeat(one_vec).take(SMALL_SIZE).collect();
let many_vecs_iter = many_vecs.iter().map(|v| v.as_slice());

let array = Arc::new(BinaryArray::from_iter_values(many_vecs_iter.clone()));
let array = Arc::new(BinaryArray::from_iter_values(many_vecs_iter));
let mut options = RoundTripOptions::new(array, false);
options.bloom_filter = true;

let files = one_column_roundtrip_with_options(options);
check_bloom_filter(
files,
"col".to_string(),
Arc::new(BinaryArray::from_iter_values(many_vecs_iter)),
array.clone(),
Arc::new(BinaryArray::from_iter_values(
vec![vec![(SMALL_SIZE + 1) as u8]]
.iter()
Expand Down

0 comments on commit aa03bb7

Please sign in to comment.