nealrichardson commented on code in PR #13985: URL: https://github.com/apache/arrow/pull/13985#discussion_r957727487
########## r/R/expression.R: ########## @@ -260,6 +255,52 @@ build_expr <- function(FUN, expr } +wrap_scalars <- function(args, FUN) { + arrow_fun <- .array_function_map[[FUN]] %||% FUN + if (arrow_fun == "if_else") { + # For if_else, the first arg should be a bool Expression, and we don't + # want to consider that when casting the other args to the same type + args[-1] <- wrap_scalars(args[-1], FUN = "") + return(args) + } + + is_expr <- map_lgl(args, ~ inherits(., "Expression")) + if (all(is_expr)) { + # No wrapping is required + return(args) + } + + args[!is_expr] <- lapply(args[!is_expr], Scalar$create) + + # Some special casing by function Review Comment: The ideal solution for the division ops should consolidate this logic with the nearly identical version in arrow-datum.R. (Well, the actual ideal solution would be ARROW-12755.) -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org