Github user sun-rui commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9835#discussion_r45723104
  
    --- Diff: R/pkg/R/utils.R ---
    @@ -624,15 +624,22 @@ convertNamedListToEnv <- function(namedList) {
       env
     }
     
    -# Assign a new environment for attach() and with() methods
    -assignNewEnv <- function(data) {
    -  stopifnot(class(data) == "DataFrame")
    -  cols <- columns(data)
    -  stopifnot(length(cols) > 0)
    -
    +# Put each column of a DataFrame into a new environment
    +# putAsDataFrame:
    +#   TRUE - Put each column as a DataFrame into the new environment
    +#   FALSE - Put each column as a Column into the new environment
    +columnIntoNewEnv <- function(df, putAsDataFrame = TRUE) {
    +  stopifnot(class(df) == "DataFrame")
    +  cols <- columns(df)
    +  
       env <- new.env()
    -  for (i in 1:length(cols)) {
    -    assign(x = cols[i], value = data[, cols[i]], envir = env)
    -  }
    +  lapply(seq_along(cols), function(i) {
    +    if (putAsDataFrame) {
    +      value <- df[, cols[i]]
    --- End diff --
    
    yes, will have a cache for the environment per DataFrame.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to