isidentical commented on code in PR #3804:
URL: https://github.com/apache/arrow-datafusion/pull/3804#discussion_r993804566
##########
datafusion/physical-expr/src/regex_expressions.rs:
##########
@@ -513,4 +539,40 @@ mod tests {
}
}
}
+
+ #[test]
+ fn test_static_pattern_regexp_replace_with_null_buffers() {
+ let values = StringArray::from(vec![
+ Some("a"),
+ None,
+ Some("b"),
+ None,
+ Some("a"),
+ None,
+ None,
+ Some("c"),
+ ]);
+ let patterns = StringArray::from(vec!["a"; 1]);
+ let replacements = StringArray::from(vec!["foo"; 1]);
+ let expected = StringArray::from(vec![
+ Some("foo"),
+ None,
+ Some("b"),
+ None,
+ Some("foo"),
+ None,
+ None,
+ Some("c"),
+ ]);
+
+ let re = _regexp_replace_static_pattern_replace::<i32>(&[
+ Arc::new(values),
+ Arc::new(patterns),
+ Arc::new(replacements),
+ ])
+ .unwrap();
+
+ assert_eq!(re.as_ref(), &expected);
+ assert_eq!(re.null_count(), 4);
Review Comment:
Great catch, and thanks for the suggestion @alamb! Should be added now.
--
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]