We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e9471d3 commit a1d66c5Copy full SHA for a1d66c5
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/random.scala
@@ -37,7 +37,11 @@ abstract class RDG(seed: Long) extends LeafExpression with Serializable {
37
* Record ID within each partition. By being transient, the Random Number Generator is
38
* reset every time we serialize and deserialize it.
39
*/
40
- @transient protected lazy val rng = new XORShiftRandom(seed + TaskContext.get().partitionId())
+ @transient protected lazy val partitionId = TaskContext.get() match {
41
+ case null => 0
42
+ case _ => TaskContext.get().partitionId()
43
+ }
44
+ @transient protected lazy val rng = new XORShiftRandom(seed + partitionId)
45
46
override def deterministic: Boolean = false
47
0 commit comments