You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/09/18 19:35:22 UTC

[GitHub] [arrow-rs] alamb commented on a diff in pull request #4832: Fix like scalar null

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


##########
arrow-string/src/like.rs:
##########
@@ -1539,4 +1536,31 @@ mod tests {
             ]),
         );
     }
+
+    #[test]
+    fn like_scalar_null() {
+        let a = StringArray::new_scalar("a");
+        let b = Scalar::new(StringArray::new_null(1));
+        let r = like(&a, &b).unwrap();
+        assert_eq!(r.len(), 1);
+        assert_eq!(r.null_count(), 1);

Review Comment:
   I suggest also verifing that `r.is_valid(0) == false`  (though I realize this is technically redundant I think it might capture the intent of the test better)



##########
arrow-string/src/like.rs:
##########
@@ -155,20 +155,17 @@ fn apply<O: OffsetSizeTrait>(
 ) -> Result<BooleanArray, ArrowError> {
     let l_len = l_v.map(|l| l.len()).unwrap_or(l.len());
     if r_s {
-        let scalar = match r_v {
-            Some(dict) => match dict.nulls().filter(|n| n.null_count() != 0) {

Review Comment:
   is the bug the difference in the null 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: github-unsubscribe@arrow.apache.org

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