diff options
author | Sameer Agarwal <sameer@databricks.com> | 2016-03-09 18:16:29 -0800 |
---|---|---|
committer | Yin Huai <yhuai@databricks.com> | 2016-03-09 18:16:29 -0800 |
commit | 926e9c45a21c5b71ef0832d63b8dae7d4f3d8826 (patch) | |
tree | 227211ad6ab438c84af70db42c2fb6245efb9b2c /sql/catalyst | |
parent | a4a0addccffb7cd0ece7947d55ce2538afa54c97 (diff) | |
download | spark-926e9c45a21c5b71ef0832d63b8dae7d4f3d8826.tar.gz spark-926e9c45a21c5b71ef0832d63b8dae7d4f3d8826.tar.bz2 spark-926e9c45a21c5b71ef0832d63b8dae7d4f3d8826.zip |
[SPARK-13760][SQL] Fix BigDecimal constructor for FloatType
## What changes were proposed in this pull request?
A very minor change for using `BigDecimal.decimal(f: Float)` instead of `BigDecimal(f: float)`. The latter is deprecated and can result in inconsistencies due to an implicit conversion to `Double`.
## How was this patch tested?
N/A
cc yhuai
Author: Sameer Agarwal <sameer@databricks.com>
Closes #11597 from sameeragarwal/bigdecimal.
Diffstat (limited to 'sql/catalyst')
-rw-r--r-- | sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala index bc2df0fb4a..bc83f9e70d 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala @@ -748,7 +748,7 @@ case class Round(child: Expression, scale: Expression) if (f.isNaN || f.isInfinite) { f } else { - BigDecimal(f).setScale(_scale, HALF_UP).toFloat + BigDecimal.decimal(f).setScale(_scale, HALF_UP).toFloat } case DoubleType => val d = input1.asInstanceOf[Double] |