Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/11911#discussion_r57200049
--- Diff: core/src/main/scala/org/apache/spark/SparkContext.scala ---
@@ -1745,11 +1745,16 @@ class SparkContext(config: SparkConf) extends
Logging with ExecutorAllocationCli
* has overridden the call site using `setCallSite()`, this will return
the user's version.
*/
private[spark] def getCallSite(): CallSite = {
- val callSite = Utils.getCallSite()
--- End diff --
I thought I tried that and it didn't work, but I must have done something
wrong. It seems to:
```
scala> def foo(): Int = { println("foo"); 42 }
foo: ()Int
scala> def bar(arg: Boolean): Int = { lazy val f = foo(); if (arg) { f }
else { 0 } }
bar: (arg: Boolean)Int
scala> bar(true)
foo
res0: Int = 42
scala> bar(false)
res1: Int = 0
```
So yeah that could be a much cleaner solution.
---
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]