ianmcook commented on a change in pull request #10191: URL: https://github.com/apache/arrow/pull/10191#discussion_r631530324
########## File path: r/R/dplyr.R ########## @@ -58,40 +63,36 @@ arrow_dplyr_query <- function(.data) { ) } +make_field_refs <- function(field_names) { + set_names(lapply(field_names, Expression$field_ref), field_names) +} + #' @export print.arrow_dplyr_query <- function(x, ...) { schm <- x$.data$schema - cols <- get_field_names(x) - # If cols are expressions, they won't be in the schema and will be "" in cols - fields <- map_chr(cols, function(name) { + fields <- map_chr(x$selected_columns, function(expr) { + name <- expr$field_name if (nzchar(name)) { schm$GetFieldByName(name)$ToString() } else { + # It's "" because this is not a field_ref, it's a more complex expression "expr" Review comment: Would this also enable ARROW-12291? -- 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