zhuqi-lucas commented on code in PR #7860: URL: https://github.com/apache/arrow-rs/pull/7860#discussion_r2184192136
########## arrow-ord/src/sort.rs: ########## @@ -295,12 +295,89 @@ fn sort_bytes<T: ByteArrayType>( options: SortOptions, limit: Option<usize>, ) -> UInt32Array { - let mut valids = value_indices + // 1. construct a list of (index, raw_bytes, length) + let mut valids: Vec<(u32, &[u8], usize)> = value_indices .into_iter() - .map(|index| (index, values.value(index as usize).as_ref())) - .collect::<Vec<(u32, &[u8])>>(); + .map(|idx| { + let slice: &[u8] = values.value(idx as usize).as_ref(); + (idx, slice, slice.len()) Review Comment: Thank you @Dandandan , very good point! -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org