pepijnve commented on code in PR #10161:
URL: https://github.com/apache/arrow-rs/pull/10161#discussion_r3451833975


##########
arrow-string/src/concat_elements.rs:
##########
@@ -221,6 +221,163 @@ pub fn concat_elements_fixed_size_binary(
     Ok(result.finish())
 }
 
+struct ConcatByteViewBuilder<T>
+where
+    T: ByteViewType,
+{
+    views: Vec<u128>,
+    data: Vec<u8>,
+    inline: Vec<u8>,
+    phantom: PhantomData<T>,
+}
+
+impl<T> ConcatByteViewBuilder<T>
+where
+    T: ByteViewType,
+{
+    /// Returns the elementwise concatenation of two [`GenericByteViewArray`]s.
+    fn concat_elements_view_array(
+        left: &GenericByteViewArray<T>,
+        right: &GenericByteViewArray<T>,
+    ) -> Result<GenericByteViewArray<T>, ArrowError> {
+        let len = left.len();
+        if len != right.len() {
+            return Err(ArrowError::ComputeError(format!(
+                "Arrays must have the same length: {} != {}",
+                len,
+                right.len()
+            )));
+        }
+
+        match NullBuffer::union(left.nulls(), right.nulls()) {
+            None => {
+                let data_size = left
+                    .lengths()
+                    .zip(right.lengths())
+                    .map(|(l, r)| l + r)
+                    .filter(|len| *len > MAX_INLINE_VIEW_LEN)
+                    .map(|len| len as usize)
+                    .sum();
+
+                if data_size > u32::MAX as usize {

Review Comment:
   I just noticed I had missed that one as well. I've restructured the code a 
little bit to eliminate the duplicated check.



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