Spark serializes variable value as null instead of its real value
问题 My understanding of the mechanics of Spark's code distribution toward the nodes running it is merely cursory, and I fail in having my code successfully run within Spark's mapPartitions API when I wish to instantiate a class for each partition, with an argument. The code below worked perfectly, up until I evolved the class MyWorkerClass to require an argument: val result : DataFrame = inputDF.as[Foo].mapPartitions(sparkIterator => { // (1) initialize heavy class instance once per partition val