You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/25 11:33:35 UTC

[GitHub] [arrow-rs] alamb commented on a diff in pull request #1608: Add `substring` support for binary

alamb commented on code in PR #1608:
URL: https://github.com/apache/arrow-rs/pull/1608#discussion_r857527231


##########
arrow/src/compute/kernels/substring.rs:
##########
@@ -25,7 +26,68 @@ use crate::{
 };
 use std::cmp::Ordering;
 
-fn generic_substring<OffsetSize: StringOffsetSizeTrait>(
+fn binary_substring<OffsetSize: BinaryOffsetSizeTrait>(

Review Comment:
   Rather than replicate quite so much code, I wonder if it would be possible to make `generic_substring` take a function to check char boundaries and and then pass in a function that does nothing
   
   Maybe like(untested):
   
   ```rust
   fn generic_substring<OffsetSize, F>(
       array: &GenericBinaryArray<OffsetSize>,
       start: OffsetSize,
       length: Option<OffsetSize>,
       check_char_boundary: F,
   )
   where 
     OffsetSize: StringOffsetSizeTrait,
     F: Fn(OffsetSize) -> Result<OffsetSize>
   {
   ...
   }



-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org