Skip to content

Commit

Permalink
Using a builder, per review suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
westonpace committed Dec 5, 2023
1 parent 0c1bb9c commit 1c72fa2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arrow-select/src/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use std::sync::Arc;

use arrow_array::builder::BufferBuilder;
use arrow_array::builder::{BufferBuilder, UInt32Builder};
use arrow_array::cast::AsArray;
use arrow_array::types::*;
use arrow_array::*;
Expand Down Expand Up @@ -689,7 +689,7 @@ fn take_value_indices_from_fixed_size_list<IndexType>(
where
IndexType: ArrowPrimitiveType,
{
let mut values = Vec::with_capacity(length as usize * indices.len());
let mut values = UInt32Builder::with_capacity(length as usize * indices.len());

for i in 0..indices.len() {
if indices.is_valid(i) {
Expand All @@ -705,7 +705,7 @@ where
}
}

Ok(PrimitiveArray::<UInt32Type>::from(values))
Ok(values.finish())
}

/// To avoid generating take implementations for every index type, instead we
Expand Down

0 comments on commit 1c72fa2

Please sign in to comment.