You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yuming Wang (JIRA)" <ji...@apache.org> on 2019/06/26 13:00:09 UTC

[jira] [Commented] (SPARK-28171) Correct interval type conversion behavior

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

Yuming Wang commented on SPARK-28171:
-------------------------------------

{code:sql}
postgres=# select substr(version(), 0, 16), timestamp '2019-01-01 00:00:00' + interval '1 2:03:04' day to second, timestamp '2019-01-01 00:00:00' + interval '-1 2:03:04' day to second;
     substr      |      ?column?       |      ?column?
-----------------+---------------------+---------------------
 PostgreSQL 11.3 | 2019-01-02 02:03:04 | 2018-12-31 02:03:04
(1 row)
{code}

{code:sql}
dbadmin=> select version(), timestamp '2019-01-01 00:00:00' + interval '1 2:03:04' day to second, timestamp '2019-01-01 00:00:00' + interval '-1 2:03:04' day to second;
version | ?column? | ?column?
------------------------------------+---------------------+---------------------
Vertica Analytic Database v9.1.1-0 | 2019-01-02 02:03:04 | 2018-12-30 21:56:56
(1 row)
{code}


{code:sql}
presto> select timestamp '2019-01-01 00:00:00' + interval '1 2:03:04' day to second, timestamp '2019-01-01 00:00:00' + interval '-1 2:03:04' day to second;
          _col0          |          _col1
-------------------------+-------------------------
 2019-01-02 02:03:04.000 | 2018-12-30 21:56:56.000
(1 row)
{code}

{code:sql}
SQL> -- Oracle
SQL> select timestamp '2019-01-01 00:00:00' + interval '1 2:03:04' day to second, timestamp '2019-01-01 00:00:00' + interval '-1 2:03:04' day to second from dual;

TIMESTAMP'2019-01-0100:00:00'+INTERVAL'12:03:04'DAYTOSECOND
---------------------------------------------------------------------------
TIMESTAMP'2019-01-0100:00:00'+INTERVAL'-12:03:04'DAYTOSECOND
---------------------------------------------------------------------------
02-JAN-19 02.03.04.000000000 AM
30-DEC-18 09.56.56.000000000 PM
{code}

> Correct interval type conversion behavior 
> ------------------------------------------
>
>                 Key: SPARK-28171
>                 URL: https://issues.apache.org/jira/browse/SPARK-28171
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Zhu, Lipeng
>            Priority: Major
>
> When calculate between date and interval.
> {code:sql}
> select timestamp '2019-01-01 00:00:00' + interval '1 2:03:04' day to second, timestamp '2019-01-01 00:00:00' + interval '-1 2:03:04' day to second
> {code}
>  * PostgreSQL return *2019-01-02 02:03:04*    *2018-12-31 02:03:04*
>  * SparkSQL return    *2019-01-02 02:03:04*    *2018-12-30 21:56:56*
> {code:sql}
> select timestamp '2019-01-01 00:00:00' + interval '1 -2:03:04' day to second, timestamp '2019-01-01 00:00:00' + interval '-1 -2:03:04' day to second
> {code}
>  * PostgreSQL return *2019-01-01 21:56:56*    *2018-12-30 21:56:56*
>  * SparkSQL return    _*Interval string does not match day-time format of 'd h:m:s.n': '1 -2:03:04'(line 1, pos 50)*_



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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