nealrichardson commented on code in PR #13985: URL: https://github.com/apache/arrow/pull/13985#discussion_r957421070
########## 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: Yeah I'll look into that. I considered that for some other cases too but wasn't sure it made sense, and was also unsure of the tradeoffs of handling this at a higher layer. -- 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