sarutak commented on a change in pull request #34256:
URL: https://github.com/apache/spark/pull/34256#discussion_r727046166



##########
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 {
+    case _: YearMonthIntervalType => f(input.asInstanceOf[Integer].toDouble)
+    case _: DayTimeIntervalType => f(input.asInstanceOf[Long].toDouble)

Review comment:
       ditto.

##########
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 {
+    case _: YearMonthIntervalType => f(input.asInstanceOf[Integer].toDouble)

Review comment:
       `Integer` => `Int`?
   Also, `toDouble` is not necessary.




-- 
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]

Reply via email to