Copilot commented on code in PR #51313:
URL: https://github.com/apache/arrow/pull/51313#discussion_r3996213030


##########
r/R/dplyr-eval.R:
##########
@@ -252,6 +252,15 @@ abandon_ship <- function(err, env) {
 arrow_mask <- function(.data) {
   f_env <- new_environment(.cache$functions)
 
+  # Empty column names can't be bound into an environment (GH-40303).
+  # Like dplyr, refuse to transform such data rather than repairing names.
+  if (!all(nzchar(names(.data$selected_columns)))) {

Review Comment:
   `summarise()` calls `arrow_mask()` only after projecting `.data` to the 
variables referenced by the summary (`r/R/dplyr-summarize.R:46-75`). A table 
with an empty-name column can therefore bypass this guard whenever that column 
is unused (for example, `summarise(mean = mean(dbl))`), unlike dplyr and the 
stated policy. Validate the original query before that projection while keeping 
`select()`/`rename()` as the escape hatches.



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