nealrichardson commented on a change in pull request #10724:
URL: https://github.com/apache/arrow/pull/10724#discussion_r671525434



##########
File path: r/R/arrow-datum.R
##########
@@ -47,10 +47,25 @@ is.infinite.ArrowDatum <- function(x) {
 }
 
 #' @export
-is.na.ArrowDatum <- function(x) call_function("is_null", x)
+is.na.ArrowDatum <- function(x) {
+  if (x$type_id() %in% TYPES_WITH_NAN) {
+    call_function("is_nan", x) | call_function("is_null", x)
+  } else {
+    call_function("is_null", x)
+  }
+}
 
 #' @export
-is.nan.ArrowDatum <- function(x) call_function("is_nan", x)
+is.nan.ArrowDatum <- function(x) {
+  if (x$type_id() %in% TYPES_WITH_NAN) {
+    call_function("is_nan", x) & !call_function("is_null", x)

Review comment:
       Can save a function call this way:
   
   ```suggestion
       call_function("is_nan", x) & call_function("is_valid", x)
   ```




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


Reply via email to