boshek commented on code in PR #12818:
URL: https://github.com/apache/arrow/pull/12818#discussion_r844464046
##########
r/R/dplyr-mutate.R:
##########
@@ -112,7 +113,15 @@ mutate.Dataset <- mutate.ArrowTabular <-
mutate.RecordBatchReader <- mutate.arro
transmute.arrow_dplyr_query <- function(.data, ...) {
dots <- check_transmute_args(...)
- dplyr::mutate(.data, !!!dots, .keep = "none")
+ has_null <- vapply(dots, quo_is_null, logical(1))
+ .data <- dplyr::mutate(.data, !!!dots, .keep = "none")
+ if (is_empty(dots) | any(has_null)) return(.data)
+
+ ## keeping with: https://github.com/tidyverse/dplyr/issues/6086
+ cur_exprs <- vapply(dots, as_label, character(1))
+ new_col_names <- names(dots)
+ transmute_order <- ifelse(nzchar(new_col_names), new_col_names, cur_exprs)
Review Comment:
Very open to other approaches but the dplyr implementation of `transmute`
return the columns in the order they are given in the function call which is
now distinct from `mutate(..., .keep = "none")`. So this was what i came up
with to preserve that order. But there possibly could be a better way to
capture order?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]