You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by gatorsmile <gi...@git.apache.org> on 2017/05/27 00:46:27 UTC

[GitHub] spark pull request #18103: [SPARK-20876][SQL]If the input parameter is float...

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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org