MichaelChirico commented on a change in pull request #28386: URL: https://github.com/apache/spark/pull/28386#discussion_r416375375
########## File path: R/pkg/R/DataFrame.R ########## @@ -2287,16 +2287,19 @@ setMethod("mutate", # For named arguments, use the names for arguments as the column names # For unnamed arguments, use the argument symbols as the column names - args <- sapply(substitute(list(...))[-1], deparse) ns <- names(cols) - if (!is.null(ns)) { - lapply(seq_along(args), function(i) { - if (ns[[i]] != "") { - args[[i]] <<- ns[[i]] - } + if (is.null(ns)) ns <- rep('', length(cols)) + named_idx <- nzchar(ns) + args <- character(length(ns)) + if (any(named_idx)) args[named_idx] <- ns[named_idx] + if (!all(named_idx)) { + # SPARK-31517: deparse uses width.cutoff on wide input and the + # output is length>1, so need to collapse it to scalar + colsub <- substitute(list(...))[-1L] + args[!named_idx] <- sapply(which(!named_idx), function(ii) { + paste(trimws(deparse(colsub[[ii]])), collapse = ' ') Review comment: Just remembered `trimws` is R 3.2.0 & `SparkR` stated dependency is 3.1.0 ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org