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/03/01 18:24:34 UTC

[GitHub] [arrow] nealrichardson commented on a change in pull request #12432: ARROW-13337: [R] Define Math group generics

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: github-unsubscribe@arrow.apache.org

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