zhuqi-lucas commented on code in PR #7856: URL: https://github.com/apache/arrow-rs/pull/7856#discussion_r2182492620
########## arrow-ord/src/sort.rs: ########## @@ -311,51 +311,70 @@ fn sort_byte_view<T: ByteViewType>( limit: Option<usize>, ) -> UInt32Array { // 1. Build a list of (index, raw_view, length) - let mut valids: Vec<_> = value_indices - .into_iter() - .map(|idx| { - // SAFETY: we know idx < values.len() - let raw = unsafe { *values.views().get_unchecked(idx as usize) }; - let len = raw as u32; // lower 32 bits encode length - (idx, raw, len) - }) - .collect(); - + let mut valids: Vec<_>; // 2. Compute the number of non-null entries to partially sort - let vlimit = match (limit, options.nulls_first) { - (Some(l), true) => l.saturating_sub(nulls.len()).min(valids.len()), - _ => valids.len(), + let vlimit: usize = match (limit, options.nulls_first) { + (Some(l), true) => l.saturating_sub(nulls.len()).min(value_indices.len()), + _ => value_indices.len(), }; + // 3.a Check if all views are inline (no data buffers) + if values.data_buffers().is_empty() { Review Comment: Thank you @Dandandan , it's very clear we optimize the no data buffers path! -- 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