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 2021/04/22 20:37:00 UTC

[jira] [Commented] (SPARK-35169) Wrong result of min ANSI interval division by -1

    [ https://issues.apache.org/jira/browse/SPARK-35169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17329405#comment-17329405 ] 

Max Gekk commented on SPARK-35169:
----------------------------------

Since https://github.com/apache/spark/pull/32260 has been merged, we could fix intervals too. cc [~Gengliang.Wang] [~angerszhuuu] [~beliefer] [~cloud_fan]

> Wrong result of min ANSI interval division by -1
> ------------------------------------------------
>
>                 Key: SPARK-35169
>                 URL: https://issues.apache.org/jira/browse/SPARK-35169
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.2.0
>            Reporter: Max Gekk
>            Priority: Major
>
> The code below portraits the issue:
> {code:scala}
> scala> Seq(java.time.Period.ofMonths(Int.MinValue)).toDF("i").select($"i" / -1).show(false)
> +-------------------------------------+
> |(i / -1)                             |
> +-------------------------------------+
> |INTERVAL '-178956970-8' YEAR TO MONTH|
> +-------------------------------------+
> scala> Seq(java.time.Duration.of(Long.MinValue, java.time.temporal.ChronoUnit.MICROS)).toDF("i").select($"i" / -1).show(false)
> +---------------------------------------------------+
> |(i / -1)                                           |
> +---------------------------------------------------+
> |INTERVAL '-106751991 04:00:54.775808' DAY TO SECOND|
> +---------------------------------------------------+
> {code}
> The result cannot be a negative interval. Spark must throw an overflow exception.



--
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