Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-29777][SPARKR] SparkR::cleanClosure aggressively removes a fun…
…ction required by user function ### What changes were proposed in this pull request? The implementation for walking through the user function AST and picking referenced variables and functions, had an optimization to skip a branch if it had already seen it. This runs into an interesting problem in the following example ``` df <- createDataFrame(data.frame(x=1)) f1 <- function(x) x + 1 f2 <- function(x) f1(x) + 2 dapplyCollect(df, function(x) { f1(x); f2(x) }) ``` Results in error: ``` org.apache.spark.SparkException: R computation failed with Error in f1(x) : could not find function "f1" Calls: compute -> computeFunc -> f2 ``` ### Why are the changes needed? Bug fix ### Does this PR introduce any user-facing change? No ### How was this patch tested? Unit tests in `test_utils.R` Closes #26429 from falaki/SPARK-29777. Authored-by: Hossein <hossein@databricks.com> Signed-off-by: HyukjinKwon <gurwls223@apache.org>
- Loading branch information