Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/18103#discussion_r118809005
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala
---
@@ -348,12 +349,13 @@ case class Floor(child: Expression) extends
UnaryMathExpression(math.floor, "FLO
}
override def inputTypes: Seq[AbstractDataType] =
- Seq(TypeCollection(LongType, DoubleType, DecimalType))
+ Seq(TypeCollection(DoubleType, DecimalType, LongType, FloatType))
protected override def nullSafeEval(input: Any): Any = child.dataType
match {
case LongType => input.asInstanceOf[Long]
+ case FloatType => f(input.asInstanceOf[Float]).toLong
case DoubleType => f(input.asInstanceOf[Double]).toLong
- case DecimalType.Fixed(precision, scale) =>
input.asInstanceOf[Decimal].floor
+ case DecimalType.Fixed(_, _) => input.asInstanceOf[Decimal].floor
}
override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
--- End diff --
You also need to fix this code path.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]