nealrichardson commented on a change in pull request #11183:
URL: https://github.com/apache/arrow/pull/11183#discussion_r712621368



##########
File path: r/R/query-engine.R
##########
@@ -20,11 +20,36 @@ do_exec_plan <- function(.data) {
   final_node <- plan$Build(.data)
   tab <- plan$Run(final_node)
 
+  # If arrange() created $temp_columns, make sure to omit them from the result
+  # We can't currently handle this in the ExecPlan itself because sorting
+  # happens in the end (SinkNode) so nothing comes after it.
   if (length(final_node$sort$temp_columns) > 0) {
-    # If arrange() created $temp_columns, make sure to omit them from the 
result
     tab <- tab[, setdiff(names(tab), final_node$sort$temp_columns), drop = 
FALSE]
   }
 
+  if (ncol(tab)) {
+    # Apply any column metadata from the original schema, where appropriate
+    original_schema <- source_data(.data)$schema
+    # TODO: do we care about other (non-R) metadata preservation?

Review comment:
       Actually, on 5.0:
   
   ```
   new <- tab %>% 
     select(carat) %>% 
     compute()
   new$metadata
   
   $pandas
   [1] "{\"index_columns\": [\"__index_level_0__\"], \"column_indexes\": 
[{\"name\":
   ...
   ```
   
   I still don't think this is necessarily meaningful--especially when you're 
dealing with multiple files with potentially different metadata. 




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