ianmcook commented on a change in pull request #10327:
URL: https://github.com/apache/arrow/pull/10327#discussion_r636614537



##########
File path: r/R/dplyr-functions.R
##########
@@ -109,6 +109,39 @@ nse_funcs$as.numeric <- function(x) {
   Expression$create("cast", x, options = cast_options(to_type = float64()))
 }
 
+# is.* type functions
+nse_funcs$is.character <- function(x) {
+  x$type_id() %in% Type[c("STRING", "LARGE_STRING")]
+}
+
+nse_funcs$is.numeric <- function(x) {
+  x$type_id() %in% c(2:12, 23:24)
+}
+
+nse_funcs$is.double <- function(x) {
+  x$type_id() %in% Type["DOUBLE"]
+}
+
+nse_funcs$is.integer <- function(x) {
+  x$type_id() %in% c(2:9)
+}
+
+nse_funcs$is.integer64 <- function(x) {
+  x$type_id() %in% Type[c("UINT64", "INT64")]
+}
+
+nse_funcs$is.logical <- function(x) {
+  x$type_id() %in% Type["BOOL"]
+}
+
+nse_funcs$is.factor <- function(x) {
+  x$type_id() == Type["DICTIONARY"]
+}
+
+nse_funcs$is.list <- function(x) {
+  x$type_id() %in% Type[c("LIST", "FIXED_SIZE_LIST", "LARGE_LIST")]
+}
+

Review comment:
       I implemented `is()` and the `rlang::is_*()` variants.
   
   Implementing translations for the various date and time functions will 
require a lot more thought and planning. I think that's best done separately, 
in ARROW-12844. I noted that there that we should implement the date and time 
`is` and `as` functions.




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

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


Reply via email to