jonkeane commented on a change in pull request #11183:
URL: https://github.com/apache/arrow/pull/11183#discussion_r712522575
##########
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:
Hmm, Arrow to R conversion losing the metadata sounds like what I
expected. TBH I _am_ a little surprised that the following happens silently,
since the `tab` below _does_ have the pandas metadata there. Though that's been
in Arrow for a while and if no one has complained, I guess it's not that
important.
```
> tab <- read_parquet(system.file("v0.7.1.parquet", package = "arrow"),
as_data_frame = FALSE)
>
> dplyr::select(tab, carat)$metadata
NULL
```
--
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]