mkleen commented on code in PR #11625:
URL: https://github.com/apache/arrow-rs/pull/11625#discussion_r4303530393


##########
arrow-select/src/zip.rs:
##########
@@ -1748,4 +1750,83 @@ mod test {
         ]);
         assert_eq!(actual, &expected);
     }
+
+    #[test]
+    fn test_zip_kernel_scalar_strings_array_view_sliced_inline() {
+        // Both scalars are inlined, but each slice keeps its array's data 
buffer
+        let truthy =
+            StringViewArray::from(vec!["x", "a string longer than twelve 
bytes"]).slice(0, 1);
+        let falsy =
+            StringViewArray::from(vec!["hello", "another string longer than 
twelve"]).slice(0, 1);
+
+        let mask = BooleanArray::from(vec![true, false, true, false]);
+        let out = zip(&mask, &Scalar::new(&truthy), 
&Scalar::new(&falsy)).unwrap();
+        out.to_data().validate_full().unwrap();
+        let actual = out.as_string_view();
+        let expected = StringViewArray::from(vec!["x", "hello", "x", "hello"]);
+        assert_eq!(actual, &expected);
+    }
+
+    #[test]
+    fn test_zip_kernel_scalar_binary_array_view_sliced_inline_short() {
+        // A falsy value of at most 4 bytes keeps zero padding in view bytes 8 
to 11

Review Comment:
   In both tests the values are inlined. "hello" is long enough for its data to 
reach bytes 8–11, while "ab" isn't, so only the padding gets corrupted.



##########
arrow-select/src/zip.rs:
##########
@@ -1748,4 +1750,83 @@ mod test {
         ]);
         assert_eq!(actual, &expected);
     }
+
+    #[test]
+    fn test_zip_kernel_scalar_strings_array_view_sliced_inline() {
+        // Both scalars are inlined, but each slice keeps its array's data 
buffer
+        let truthy =
+            StringViewArray::from(vec!["x", "a string longer than twelve 
bytes"]).slice(0, 1);
+        let falsy =
+            StringViewArray::from(vec!["hello", "another string longer than 
twelve"]).slice(0, 1);
+
+        let mask = BooleanArray::from(vec![true, false, true, false]);
+        let out = zip(&mask, &Scalar::new(&truthy), 
&Scalar::new(&falsy)).unwrap();
+        out.to_data().validate_full().unwrap();
+        let actual = out.as_string_view();
+        let expected = StringViewArray::from(vec!["x", "hello", "x", "hello"]);
+        assert_eq!(actual, &expected);
+    }
+
+    #[test]
+    fn test_zip_kernel_scalar_binary_array_view_sliced_inline_short() {
+        // A falsy value of at most 4 bytes keeps zero padding in view bytes 8 
to 11

Review Comment:
   In both tests the values are inlined. "hello" is long enough for its data to 
reach bytes 8–11, while "ab" isn't, so only the padding gets corrupted.
   
   



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