You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Mehreen Ali (Jira)" <ji...@apache.org> on 2019/11/26 23:50:00 UTC

[jira] [Created] (SPARK-30054) Literal creation from java BigDecimal with specified target DecimalType is buggy

Mehreen Ali created SPARK-30054:
-----------------------------------

             Summary: Literal creation from java BigDecimal with specified target DecimalType is buggy
                 Key: SPARK-30054
                 URL: https://issues.apache.org/jira/browse/SPARK-30054
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.4.4
            Reporter: Mehreen Ali


Literal creation from java BigDecimal with specified target DecimalType is buggy.
{code:java}
scala> Literal.create(new java.math.BigDecimal("0.01"), DecimalType(26, 6))
org.apache.spark.sql.AnalysisException: Decimal scale (2) cannot be greater than precision (1).;
  at org.apache.spark.sql.types.DecimalType.<init>(DecimalType.scala:46)
  at org.apache.spark.sql.catalyst.CatalystTypeConverters$.convertToCatalyst(CatalystTypeConverters.scala:408)
  at org.apache.spark.sql.catalyst.expressions.Literal$.create(literals.scala:155)
  ... 51 elided
{code}
{code:java}
scala> CatalystTypeConverters.convertToCatalyst(new java.math.BigDecimal("0.01"))
org.apache.spark.sql.AnalysisException: Decimal scale (2) cannot be greater than precision (1).;
  at org.apache.spark.sql.types.DecimalType.<init>(DecimalType.scala:46)
  at org.apache.spark.sql.catalyst.CatalystTypeConverters$.convertToCatalyst(CatalystTypeConverters.scala:408)
  ... 51 elided
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org