Skip to content

Commit

Permalink
Applying suggetions from review
Browse files Browse the repository at this point in the history
  • Loading branch information
westonpace committed Dec 5, 2023
1 parent 6bf9562 commit 0c1bb9c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions arrow-select/src/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ fn take_value_indices_from_fixed_size_list<IndexType>(
where
IndexType: ArrowPrimitiveType,
{
let mut values = vec![];
let mut values = Vec::with_capacity(length as usize * indices.len());

for i in 0..indices.len() {
if indices.is_valid(i) {
Expand Down Expand Up @@ -1989,7 +1989,7 @@ mod tests {

#[test]
fn test_take_fixed_size_list_null_indices() {
let indices = Int32Array::from_iter([Some(1), None]);
let indices = Int32Array::from_iter([Some(0), None]);
let values = Arc::new(Int32Array::from(vec![0, 1, 2, 3]));
let arr_field = Arc::new(Field::new("item", values.data_type().clone(), true));
let values = FixedSizeListArray::try_new(arr_field, 2, values, None).unwrap();
Expand All @@ -1999,7 +1999,8 @@ mod tests {
.as_fixed_size_list()
.values()
.as_primitive::<Int32Type>()
.values();
.into_iter()
.collect::<Vec<_>>();
assert_eq!(values, &[Some(0), Some(1), None, None])
}

Expand Down

0 comments on commit 0c1bb9c

Please sign in to comment.