-
- Downloads
[SPARK-10245] [SQL] Fix decimal literals with precision < scale
In BigDecimal or java.math.BigDecimal, the precision could be smaller than scale, for example, BigDecimal("0.001") has precision = 1 and scale = 3. But DecimalType require that the precision should be larger than scale, so we should use the maximum of precision and scale when inferring the schema from decimal literal. Author: Davies Liu <davies@databricks.com> Closes #8428 from davies/smaller_decimal.
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala 4 additions, 3 deletions.../org/apache/spark/sql/catalyst/expressions/literals.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/LiteralExpressionSuite.scala 5 additions, 3 deletions...ark/sql/catalyst/expressions/LiteralExpressionSuite.scala
- sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala 10 additions, 0 deletions...e/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
Please register or sign in to comment