-
- Downloads
[SPARK-17494][SQL] changePrecision() on compact decimal should respect rounding mode
## What changes were proposed in this pull request? Floor()/Ceil() of decimal is implemented using changePrecision() by passing a rounding mode, but the rounding mode is not respected when the decimal is in compact mode (could fit within a Long). This Update the changePrecision() to respect rounding mode, which could be ROUND_FLOOR, ROUND_CEIL, ROUND_HALF_UP, ROUND_HALF_EVEN. ## How was this patch tested? Added regression tests. Author: Davies Liu <davies@databricks.com> Closes #15154 from davies/decimal_round.
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala 24 additions, 4 deletions...t/src/main/scala/org/apache/spark/sql/types/Decimal.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/types/DecimalSuite.scala 15 additions, 0 deletions.../test/scala/org/apache/spark/sql/types/DecimalSuite.scala
Loading
Please register or sign in to comment