jonkeane commented on a change in pull request #10888:
URL: https://github.com/apache/arrow/pull/10888#discussion_r698579535



##########
File path: r/R/dataset-scan.R
##########
@@ -85,9 +86,30 @@ Scanner$create <- function(dataset,
       # To handle mutate() on Table/RecordBatch, we need to 
collect(as_data_frame=FALSE) now
       dataset <- dplyr::collect(dataset, as_data_frame = FALSE)
     }
+
+    proj <- c(dataset$selected_columns, dataset$temp_columns)
+
+    if (!is.null(projection)) {
+      if (is.character(projection)) {
+        proj <- proj[projection]
+      } else if (is_list_of(projection, "Expression")) {
+        # TODO: need to check and see if there are any Expressions that are 
simply
+        # field refs in projections, but are richer expressions in proj?
+        proj <- projection

Review comment:
       @nealrichardson do you have any thoughts on this? I've looked into using 
`projection[[i]]$field_name` to identify any references to fields, and then 
replace them with what's in `proj[projection[[i]]$field_name]`, which should 
work for this case, but looks brittle to me (but maybe I'm being paranoid?).




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


Reply via email to