MaxGekk commented on a change in pull request #34256:
URL: https://github.com/apache/spark/pull/34256#discussion_r727315953
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala
##########
@@ -658,6 +658,13 @@ case class Rint(child: Expression) extends
UnaryMathExpression(math.rint, "ROUND
since = "1.4.0",
group = "math_funcs")
case class Signum(child: Expression) extends UnaryMathExpression(math.signum,
"SIGNUM") {
+ override def inputTypes: Seq[AbstractDataType] =
+ Seq(TypeCollection(DoubleType, YearMonthIntervalType, DayTimeIntervalType))
+ protected override def nullSafeEval(input: Any): Any = child.dataType match {
Review comment:
I think we could avoid checking the type in runtime completely:
```scala
protected override def nullSafeEval(input: Any): Any = {
f(input.asInstanceOf[Number].doubleValue())
}
```
--
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]