viirya commented on code in PR #1633: URL: https://github.com/apache/arrow-rs/pull/1633#discussion_r862608650
########## arrow/src/compute/kernels/substring.rs: ########## @@ -86,6 +86,52 @@ fn binary_substring<OffsetSize: BinaryOffsetSizeTrait>( Ok(make_array(data)) } +fn fixed_size_binary_substring( + array: &FixedSizeBinaryArray, + old_len: i32, + start: i32, + length: Option<i32>, +) -> Result<ArrayRef> { + let new_start = if start >= 0 { + start.min(old_len) + } else { + (old_len + start).max(0) + }; + let new_len = match length { + Some(len) => len.min(old_len - new_start), + None => old_len - new_start, + }; Review Comment: Is it possible that if `length` is negative? `DataType::FixedSizeBinary(negative)` seems invalid. -- 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