You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Max Gekk (Jira)" <ji...@apache.org> on 2024/08/26 12:53:00 UTC

[jira] [Resolved] (SPARK-49311) Large INTERVAL SECOND values cannot be cast to decimal

     [ https://issues.apache.org/jira/browse/SPARK-49311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Max Gekk resolved SPARK-49311.
------------------------------
    Resolution: Fixed

Issue resolved by pull request 47808
[https://github.com/apache/spark/pull/47808]

> Large INTERVAL SECOND values cannot be cast to decimal
> ------------------------------------------------------
>
>                 Key: SPARK-49311
>                 URL: https://issues.apache.org/jira/browse/SPARK-49311
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 4.0.0
>            Reporter: Harsh Motwani
>            Assignee: Harsh Motwani
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>
> Spark fails when trying to cast an `interval second` value to decimal where the number of microseconds requires 19 digits.
> {code:java}
> scala> sql("select 1000000000000.000000::interval second").show(false)
> +---------------------------------------------+
> |CAST(1000000000000.000000 AS INTERVAL SECOND)|
> +---------------------------------------------+
> |INTERVAL '1000000000000' SECOND              |
> +---------------------------------------------+
>  
>  
> scala> sql("select 1000000000000.000000::interval second::decimal(38, 10)").show(false)
> org.apache.spark.SparkArithmeticException: [NUMERIC_VALUE_OUT_OF_RANGE.WITH_SUGGESTION]  0 cannot be represented as Decimal(18, 6). If necessary set "spark.sql.ansi.enabled" to "false" to bypass this error, and return NULL instead. SQLSTATE: 22003
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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