ianmcook commented on a change in pull request #9586:
URL: https://github.com/apache/arrow/pull/9586#discussion_r588596519



##########
File path: r/R/dplyr.R
##########
@@ -539,6 +537,13 @@ mutate.arrow_dplyr_query <- function(.data,
     if (inherits(results[[new_var]], "try-error")) {
       msg <- paste('Expression', as_label(exprs[[i]]), 'not supported in 
Arrow')
       return(abandon_ship(call, .data, msg))
+    } else if (is_dataset && !inherits(results[[new_var]], "Expression")) {
+      # We need some wrapping to handle literal values
+      if (length(results[[new_var]]) != 1) {
+        msg <- paste0('In ', new_var, " = ", as_label(exprs[[i]]), ", only 
values of size one are recycled")

Review comment:
       If you `mutate(NULL)` or `transmute(NULL)` it gets caught by this and 
gives the message:
   ```
   Error: In NULL = NULL, only values of size one are recycled
   Call collect() first to pull data into R. 
   ```
   We should handle that case separately and make it behave the same as a 
no-argument `mutate()` or `transmute()` (that is, return all the columns or no 
columns respectively)




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

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


Reply via email to