HyukjinKwon commented on a change in pull request #30977:
URL: https://github.com/apache/spark/pull/30977#discussion_r550372054



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/randomExpressions.scala
##########
@@ -44,8 +44,8 @@ abstract class RDG extends UnaryExpression with 
ExpectsInputTypes with Stateful
   }
 
   @transient protected lazy val seed: Long = child match {
-    case Literal(s, IntegerType) => s.asInstanceOf[Int]
-    case Literal(s, LongType) => s.asInstanceOf[Long]
+    case e if e.dataType == IntegerType => e.eval().asInstanceOf[Int]
+    case e if e.dataType == LongType => e.eval().asInstanceOf[Long]
     case _ => throw new AnalysisException(
       s"Input argument to $prettyName must be an integer, long or null 
literal.")

Review comment:
       The analysis check is done somewhere in the master 
(https://github.com/apache/spark/pull/30923/files#diff-583171e935b2dc349378063a5841c5b98b30a2d57ac3743a9eccfe7bffcb8f2aR219-R221)
 but It should throw at least for Scala 2.13 error 
(https://github.com/apache/spark/pull/30923#discussion_r549707053).




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to