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



##########
File path: r/R/arrow-datum.R
##########
@@ -70,13 +70,51 @@ as.vector.ArrowDatum <- function(x, mode) {
 
 #' @export
 Ops.ArrowDatum <- function(e1, e2) {
-  if (.Generic == "!") {
-    eval_array_expression(.Generic, e1)
-  } else if (.Generic %in% names(.array_function_map)) {
-    eval_array_expression(.Generic, e1, e2)
-  } else {
-    stop(paste0("Unsupported operation on `", class(e1)[1L], "` : "), 
.Generic, call. = FALSE)
+  if (missing(e2)) {
+    switch(
+      .Generic,
+      "!" = return(eval_array_expression(.Generic, e1)),
+      "+" =, "-" = return(eval_array_expression(.Generic, 0L, e1)),

Review comment:
       There is a `negate_checked` function we use elsewhere for unary `-` that 
you can use here




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