You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/25 19:34:21 UTC

[GitHub] [arrow-rs] alamb commented on a diff in pull request #1738: Support casting `Utf8` to `Boolean`

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


##########
arrow/src/compute/kernels/cast.rs:
##########
@@ -1661,6 +1660,34 @@ fn cast_string_to_timestamp_ns<Offset: OffsetSizeTrait>(
     Ok(Arc::new(array) as ArrayRef)
 }
 
+/// Casts Utf8 to Boolean
+fn cast_utf8_to_boolean(from: &ArrayRef, cast_options: &CastOptions) -> Result<ArrayRef> {
+    let array = from.as_any().downcast_ref::<StringArray>().unwrap();

Review Comment:
   You can also use `as_string_array()` function if you want to save some typing



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