Uh oh!
There was an error while loading. Please reload this page.
[SPARK-29777][SparkR] SparkR::cleanClosure aggressively removes a function required by user function - #26429
[SPARK-29777][SparkR] SparkR::cleanClosure aggressively removes a function required by user function#26429falaki wants to merge 5 commits into
Conversation
falaki
commented
Nov 7, 2019
@mengxr can we cherry-pick this to 2.4.x? |
SparkQA
commented
Nov 8, 2019
Test build #113409 has finished for PR 26429 at commit
|
| found <- sapply(funcList, function(func) { | ||
| ifelse(identical(func, obj), TRUE, FALSE) | ||
| }) | ||
| if (sum(found) > 0) { |
There was a problem hiding this comment.
Discussed offline. The change would lead to dead loop. We should make sure newEnv contains the (cleaned) node.
There was a problem hiding this comment.
Is the dead loop case when the same function with the same environments is recursively called in the closure?
SparkQA
commented
Nov 9, 2019
Test build #113493 has finished for PR 26429 at commit
|
dongjoon-hyun
commented
Nov 10, 2019
Retest this please. |
SparkQA
commented
Nov 10, 2019
Test build #113519 has finished for PR 26429 at commit
|
falaki
commented
Nov 11, 2019
@shivaram and @felixcheung do you guys have any input on this? |
falaki
commented
Nov 13, 2019
@HyukjinKwon would you please take a look? |
HyukjinKwon
commented
Nov 14, 2019
retest this please |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Nov 14, 2019
Test build #113738 has finished for PR 26429 at commit
|
| f1 <- function(x) x + 1 | ||
| f2 <- function(x) f1(x) + 2 | ||
| user_func <- function(x) { f1(x); f2(x) } | ||
| c_user_func_env <- environment(cleanClosure(user_func)) |
There was a problem hiding this comment.
BTW, I think naming c_user_func_env is not preferred (it was discussed here #17590 (comment)) before.
I think it should rather be cUserFuncEnv.
Google guide seems updated rapidly (https://google.github.io/styleguide/Rguide.html).. We will have to update the guide ...
HyukjinKwon
commented
Nov 14, 2019
Looks fine except two nits: #26429 (comment) and #26429 (comment) |
falaki
commented
Nov 14, 2019
Thanks for reviewing @HyukjinKwon I addressed your comments. |
SparkQA
commented
Nov 15, 2019
Test build #113814 has finished for PR 26429 at commit
|
HyukjinKwon
commented
Nov 15, 2019
retest this please |
SparkQA
commented
Nov 15, 2019
Test build #113827 has finished for PR 26429 at commit
|
The test cases should be fixed as of 65a189c |
srowen
commented
Nov 16, 2019
Just needs a rebase? |
felixcheung
commented
Nov 17, 2019
via email
Looks reasonable to me …________________________________ |
falaki
commented
Nov 18, 2019
Rebased this. Sorry for the delay. |
SparkQA
commented
Nov 18, 2019
Test build #114031 has finished for PR 26429 at commit
|
HyukjinKwon
commented
Nov 19, 2019
Let's give a try. |
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
Results in error:
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