Github user shivaram commented on a diff in the pull request:
https://github.com/apache/spark/pull/19342#discussion_r140920250
--- Diff: R/pkg/R/DataFrame.R ---
@@ -3250,6 +3250,7 @@ setMethod("attach",
function(what, pos = 2, name = deparse(substitute(what)),
warn.conflicts = TRUE) {
newEnv <- assignNewEnv(what)
attach(newEnv, pos = pos, name = name, warn.conflicts =
warn.conflicts)
+ on.exit(detach(newEnv, pos = pos, name = name))
--- End diff --
The point of this function is to allow users to attach the column names of
the SparkDataFrame into their environment. So in some sense it is mimic'ing
`attach(df)` in R. Following this users can directly use the column name in
expressions like `select` etc.
So adding a detach on function exit defeats the purpose. The only way I see
to not use attach is to remove this feature ?
cc @felixcheung
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]