Github user tdas commented on the pull request:
https://github.com/apache/spark/pull/783#issuecomment-43161420
Just to explain further, `ControlThrowable`s like `NonLocalReturnControl`
is used by the scala runtime for legit control flow. For example, here is a
example,
```
def foo(l: List[Int]): Int = {
l.foreach { (i) =>
println(i)
return 5
}
return 10
}
```
The `return 5` is supposed to return from the function `foo`. But if you
think how scala compiles this, the foreach function is essentially another anon
class, and simple `return` inside it would only return from the `foreach`
function and not the method `foo`. So what scala does is throw this
`NonLocalReturnControl` throwable, to get out of the foreach function and then
return from the method `foo`. This is the normal control flow and therefore is
expected to occur and should neither be ignored, nor be logged.
@marmbrus I hope I explained this right. He explained this to me and
@aarondav
Example stolen from
http://dev.bizo.com/2010/01/scala-supports-non-local-returns.html
---
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.
---