Jefffrey commented on code in PR #11973:
URL: https://github.com/apache/arrow-rs/pull/11973#discussion_r4559019839
##########
arrow-data/src/transform/mod.rs:
##########
@@ -83,7 +82,6 @@ fn build_extend_null_bits(array: &ArrayData, use_nulls: bool)
-> ExtendNullBits<
Box::new(|mutable, _, len| {
let mutable_len = mutable.len;
let out = mutable.null_buffer();
- utils::resize_for_bits(out, mutable_len + len);
Review Comment:
why are these being removed?
##########
arrow-data/src/transform/mod.rs:
##########
@@ -212,23 +210,19 @@ fn build_extend_view(array: &ArrayData, buffer_offset:
u32) -> Extend<'_> {
let views = array.buffer::<u128>(0);
Box::new(
move |mutable: &mut _MutableArrayData, _, start: usize, len: usize| {
+ let values = &views[start..start + len];
+ let dst_start = mutable.buffer1.len() / mem::size_of::<u128>();
mutable
.buffer1
- .extend(views[start..start + len].iter().map(|v| {
- // A view of a string of 12 bytes or fewer stores the
- // string inline and has no buffer index, so adding 0
- // leaves it unchanged.
- let offset = if *v as u32 > MAX_INLINE_VIEW_LEN {
- buffer_offset
- } else {
- 0
- };
- // The buffer index is bits 64 to 95 of a view. Adding
- // `buffer_offset` gives the string's buffer index in the
- // output, which fits in 32 bits, so the sum never carries
- // into bit 96.
- v + ((offset as u128) << 64)
- }));
+ .try_extend_from_slice(values)
+ .map_err(|e| ArrowError::MemoryError(e.to_string()))?;
+ if buffer_offset != 0 {
+ for view in &mut
mutable.buffer1.typed_data_mut::<u128>()[dst_start..] {
+ if *view as u32 > MAX_INLINE_VIEW_LEN {
+ *view += (buffer_offset as u128) << 64;
Review Comment:
should we keep the comment here
--
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]