You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/01/03 23:58:03 UTC
[GitHub] [spark] maropu commented on a change in pull request #30977: [SPARK-33945][SQL][3.1] Handles a random seed consisting of an expr tree
maropu commented on a change in pull request #30977:
URL: https://github.com/apache/spark/pull/30977#discussion_r551071649
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/randomExpressions.scala
##########
@@ -44,10 +44,10 @@ 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 child.foldable && e.dataType == IntegerType => e.eval().asInstanceOf[Int]
+ case e if child.foldable && e.dataType == LongType => e.eval().asInstanceOf[Long]
case _ => throw new AnalysisException(
- s"Input argument to $prettyName must be an integer, long or null literal.")
+ s"Input argument to $prettyName must be an integer or long constant.")
Review comment:
okay
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org