jhorstmann commented on code in PR #9625:
URL: https://github.com/apache/arrow-rs/pull/9625#discussion_r3015028416
##########
arrow-select/src/take.rs:
##########
@@ -490,104 +490,132 @@ fn take_boolean<IndexType: ArrowPrimitiveType>(
BooleanArray::new(val_buf, null_buf)
}
+/// Copies byte ranges from `src` into a new contiguous buffer.
+///
+/// # Safety
+/// Each `(start, end)` in `ranges` must be in-bounds of `src`, and
+/// `capacity` must equal the total bytes across all ranges.
+unsafe fn copy_byte_ranges(
+ src: &[u8],
+ ranges: &[(usize, usize)],
+ capacity: usize,
+ values: &mut Vec<u8>,
+) {
+ values.reserve(capacity);
Review Comment:
What is the expected behavior if the vec is non-empty? Currently its a bit
inconsistent in reserving additional capacity, but then overwriting any
existing content. I think appending might make sense, which means the assert
and `dst` pointer below should be based on `Vec::spare_capacity_mut`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]