alamb commented on code in PR #1738:
URL: https://github.com/apache/arrow-rs/pull/1738#discussion_r882514160
##########
arrow/src/compute/kernels/cast.rs:
##########
@@ -2638,6 +2665,35 @@ mod tests {
}
}
+ #[test]
+ fn test_cast_utf8_to_bool() {
+ let a = StringArray::from(vec!["true", "false", "invalid", " Y ", ""]);
+ let array = Arc::new(a) as ArrayRef;
+ let b = cast(&array, &DataType::Boolean).unwrap();
+ let c = b.as_any().downcast_ref::<BooleanArray>().unwrap();
+ assert!(c.value(0));
Review Comment:
Another way to write this kind of test is something like:
```rust
let expected: BooleanArray = [Some(true), Some(false), None, Some(true),
None)].collect();
assert_eq!(c, expected);
--
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]