Github user ueshin commented on the issue:

    https://github.com/apache/spark/pull/22419
  
    On second thoughts, I'm wondering whether we can reuse `RoundBase`?
    I mean:
    
    ```scala
    case class Truncate(child: Expression, scale: Expression)
      extends RoundBase(child, scale, BigDecimal.RoundingMode.DOWN, 
"ROUND_DOWN")
        with Serializable with ImplicitCastInputTypes {
      def this(child: Expression) = this(child, Literal(0))
    }
    ```
    
    If we want to round negative values towards negative infinity instead of 
towards zero, we should use `RoundingMode.FLOOR` instead of `DOWN`, thought.
    
    Btw, could you add test cases for negative value child as well?


---

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

Reply via email to