alamb commented on code in PR #1720:
URL: https://github.com/apache/arrow-rs/pull/1720#discussion_r880501204
##########
arrow/src/compute/kernels/concat.rs:
##########
@@ -102,6 +102,25 @@ pub fn concat(arrays: &[&dyn Array]) -> Result<ArrayRef> {
Ok(make_array(mutable.freeze()))
}
+// Elementwise concatenation of StringArrays
+pub fn string_concat<Offset: OffsetSizeTrait>(
+ left: &GenericStringArray<Offset>,
+ right: &GenericStringArray<Offset>,
+) -> Result<GenericStringArray<Offset>> {
+ let left_bitmap = left.data().null_bitmap().unwrap();
+ let right_bitmap = right.data().null_bitmap().unwrap();
+ let concat_bitmap = (left_bitmap & right_bitmap).unwrap();
+ Ok((0..left.len().max(right.len()))
+ .map(|i| {
+ if concat_bitmap.is_set(i) {
+ Some(left.value(i).to_owned() + right.value(i))
+ } else {
+ None
+ }
+ })
+ .collect::<GenericStringArray<Offset>>())
Review Comment:
> "valid_str" + None => None
This is the standard SQL semantic and it is how most other arrow kernels I
know of behave, thus I think it would be best for consistency
--
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]