Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/6735#discussion_r32153072
--- Diff:
core/src/test/scala/org/apache/spark/util/ClosureCleanerSuite.scala ---
@@ -350,3 +354,40 @@ private object TestUserClosuresActuallyCleaned {
)
}
}
+
+class TestCreateNullValue {
+
+ var x = 5
+
+ def getX: Int = x
+
+ def run(): Unit = {
+ val bo: Boolean = true
+ val c: Char = '1'
+ val b: Byte = 1
+ val s: Short = 1
+ val i: Int = 1
+ val l: Long = 1
+ val f: Float = 1
+ val d: Double = 1
+
+ val nestedClosure = () => {
+ if (s.toString == "123") { // Don't really output them to avoid noisy
+ println(bo)
+ println(c)
+ println(b)
+ println(s)
+ println(i)
+ println(l)
+ println(f)
+ println(d)
--- End diff --
I would add a comment above this closure that says
```
// Bring in all primitive types into the closure such that they become
parameters
// of the closure constructor. This allows us to test whether null values
are created
// correctly for each type.
```
---
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]