viirya commented on code in PR #1633:
URL: https://github.com/apache/arrow-rs/pull/1633#discussion_r863307454


##########
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:
   > Since unsigned integers can be more difficult to work with in some cases 
(e.g. in the JVM), we recommend preferring signed integers over unsigned 
integers for representing dictionary indices. Additionally, we recommend 
avoiding using 64-bit unsigned integer indices unless they are required by an 
application.
   
   This is some wordings I read in the spec. It is not talking about array 
length, but I think it might be somehow related to the question.



-- 
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]

Reply via email to