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 2020/12/29 13:36:43 UTC
[GitHub] [spark] HyukjinKwon commented on a change in pull request #30923: [SPARK-33909][SQL] Check rand functions seed is legal at analyer side
HyukjinKwon commented on a change in pull request #30923:
URL: https://github.com/apache/spark/pull/30923#discussion_r549707053
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/randomExpressions.scala
##########
@@ -47,10 +46,8 @@ abstract class RDG extends UnaryExpression with ExpectsInputTypes with Stateful
override def seedExpression: Expression = child
@transient protected lazy val seed: Long = seedExpression match {
- case Literal(s, IntegerType) => s.asInstanceOf[Int]
- case Literal(s, LongType) => s.asInstanceOf[Long]
- case _ => throw new AnalysisException(
- s"Input argument to $prettyName must be an integer, long or null literal.")
+ case e if e.dataType == IntegerType => e.eval().asInstanceOf[Int]
+ case e if e.dataType == LongType => e.eval().asInstanceOf[Long]
Review comment:
Hm, I remember Scala 2.13 issues a warning about it when there's no default case from case match. Can we still add `case _ =>`?
----------------------------------------------------------------
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