Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rust/arrow/src/compute/kernels/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ where
let mut offsets_buffer = MutableBuffer::from_len_zeroed(bytes_offset);

let offsets = offsets_buffer.typed_data_mut();
let mut values = Vec::with_capacity(bytes_offset);
let mut values = MutableBuffer::new(0);
Copy link
Contributor Author

@Dandandan Dandandan Jan 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used to be here bytes_offset but that doesn't make a lot of sense.
The values array could be empty as well (e.g. for empty strings), or have a totally different capacity.

let mut length_so_far = OffsetSize::zero();
offsets[0] = length_so_far;

Expand Down Expand Up @@ -513,7 +513,7 @@ where
let mut data = ArrayData::builder(<OffsetSize as StringOffsetSizeTrait>::DATA_TYPE)
.len(data_len)
.add_buffer(offsets_buffer.into())
.add_buffer(Buffer::from(values));
.add_buffer(values.into());
if let Some(null_buffer) = nulls {
data = data.null_bit_buffer(null_buffer);
}
Expand Down