nealrichardson commented on code in PR #13985: URL: https://github.com/apache/arrow/pull/13985#discussion_r959703483
########## 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: I created ARROW-17581 to refactor and simplify this. I'd rather not do it here because I don't want to muddy this change, and I fear it will be more invasive than it sounds. -- 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