Github user HyukjinKwon commented on a diff in the pull request: https://github.com/apache/spark/pull/15432#discussion_r83817947 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/randomExpressions.scala --- @@ -50,22 +54,27 @@ abstract class RDG extends LeafExpression with Nondeterministic { override def dataType: DataType = DoubleType - // NOTE: Even if the user doesn't provide a seed, Spark SQL adds a default seed. - override def sql: String = s"$prettyName($seed)" + override def inputTypes: Seq[AbstractDataType] = Seq(TypeCollection(IntegerType, LongType)) } /** Generate a random column with i.i.d. uniformly distributed values in [0, 1). */ +// scalastyle:off line.size.limit @ExpressionDescription( - usage = "_FUNC_(a) - Returns a random column with i.i.d. uniformly distributed values in [0, 1).") -case class Rand(seed: Long) extends RDG { - override protected def evalInternal(input: InternalRow): Double = rng.nextDouble() + usage = + """ + _FUNC_() - Returns a random column with i.i.d. uniformly distributed values in [0, 1]. + seed is given randomly. + + _FUNC_(seed) - Returns a random column with i.i.d. uniformly distributed values in [0, 1]. + seed should be an integer/long/NULL literal. + """, + extended = "> SELECT _FUNC_();\n 0.9629742951434543\n> SELECT _FUNC_(0);\n 0.8446490682263027\n> SELECT _FUNC_(NULL);\n 0.8446490682263027") --- End diff -- Sure, I will make it consistent.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org