spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tejasapatil <...@git.apache.org>
Subject [GitHub] spark pull request #17075: [SPARK-19727][SQL] Fix for round function that mo...
Date Wed, 01 Mar 2017 02:14:44 GMT
Github user tejasapatil commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17075#discussion_r103598033
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala ---
    @@ -362,17 +374,13 @@ final class Decimal extends Ordered[Decimal] with Serializable {
       def abs: Decimal = if (this.compare(Decimal.ZERO) < 0) this.unary_- else this
     
       def floor: Decimal = if (scale == 0) this else {
    -    val value = this.clone()
    -    value.changePrecision(
    -      DecimalType.bounded(precision - scale + 1, 0).precision, 0, ROUND_FLOOR)
    -    value
    +    toPrecision(DecimalType.bounded(precision - scale + 1, 0).precision, 0, ROUND_FLOOR)
    +      .getOrElse(clone())
       }
     
       def ceil: Decimal = if (scale == 0) this else {
    -    val value = this.clone()
    -    value.changePrecision(
    -      DecimalType.bounded(precision - scale + 1, 0).precision, 0, ROUND_CEILING)
    -    value
    +    toPrecision(DecimalType.bounded(precision - scale + 1, 0).precision, 0, ROUND_CEILING)
    +      .getOrElse(clone())
    --- End diff --
    
    same as above


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


Mime
View raw message