cloud-fan commented on code in PR #58200:
URL: https://github.com/apache/spark/pull/58200#discussion_r3844791068
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/randomExpressions.scala:
##########
@@ -425,6 +425,18 @@ case class RandStr(
"inputExpr" -> toSQLExpr(expr)))
}
}
+ if (result == TypeCheckResult.TypeCheckSuccess) {
+ val lengthValue = length.eval()
+ // randstr(NULL, 0) is valid (treated as 0), so only reject a negative
length.
+ if (lengthValue != null && lengthValue.asInstanceOf[Int] < 0) {
Review Comment:
**Non-blocking:**
Please update `randstr`'s `@ExpressionDescription` to say that `length` must
be non-negative. The new analysis-time check makes `[0, Int.MaxValue]` the
accepted public range, while the generated SQL docs currently describe only a
constant integer.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]