Skip to content

Commit

Permalink
Fix a NPE issue in GpuRand (#11647)
Browse files Browse the repository at this point in the history
curXORShiftRandomSeed  is marked as transient, so it will be null on executors without retry-restore context, leading to this NPE.
This fix removes the transient for curXORShiftRandomSeed, seed and previousPartition that will be used by the computation on executors.

Signed-off-by: Firestarman <[email protected]>
  • Loading branch information
firestarman authored Oct 28, 2024
1 parent 91db040 commit b653ce2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ case class GpuRand(child: Expression) extends ShimUnaryExpression with GpuExpres
*/
@transient protected var rng: RapidsXORShiftRandom = _

@transient protected lazy val seed: Long = child match {
private lazy val seed: Long = child match {
case GpuLiteral(s, IntegerType) => s.asInstanceOf[Int]
case GpuLiteral(s, LongType) => s.asInstanceOf[Long]
case _ => throw new RapidsAnalysisException(
s"Input argument to $prettyName must be an integer, long or null literal.")
}

@transient protected var previousPartition: Int = 0
private var previousPartition: Int = 0

@transient protected var curXORShiftRandomSeed: Option[Long] = None
private var curXORShiftRandomSeed: Option[Long] = None

private def wasInitialized: Boolean = rng != null

Expand Down

0 comments on commit b653ce2

Please sign in to comment.