dtenedor commented on code in PR #49210:
URL: https://github.com/apache/spark/pull/49210#discussion_r1909618156
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionHelper.scala:
##########
@@ -400,6 +401,9 @@ abstract class TypeCoercionHelper {
NaNvl(Cast(l, DoubleType), r)
case NaNvl(l, r) if r.dataType == NullType => NaNvl(l, Cast(r,
l.dataType))
+ case r: RandStr if r.length.dataType != IntegerType =>
+ r.copy(length = Cast(r.length, IntegerType))
Review Comment:
sounds good, done.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/randomExpressions.scala:
##########
@@ -330,7 +330,8 @@ object Uniform {
group = "string_funcs")
case class RandStr(
length: Expression, override val seedExpression: Expression, hideSeed:
Boolean)
- extends ExpressionWithRandomSeed with BinaryLike[Expression] with
Nondeterministic {
+ extends ExpressionWithRandomSeed with BinaryLike[Expression] with
Nondeterministic
+ with ExpectsInputTypes {
Review Comment:
Good question, we considered this, and decided together that we wanted to
require integer random seeds only and return errors for floating-point seeds.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/randomExpressions.scala:
##########
@@ -342,6 +343,10 @@ case class RandStr(
override def left: Expression = length
override def right: Expression = seedExpression
+ override def inputTypes: Seq[AbstractDataType] = Seq(
+ TypeCollection(NumericType),
Review Comment:
sounds good, done.
--
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]