You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Timo Walther (Jira)" <ji...@apache.org> on 2021/10/01 12:47:00 UTC

[jira] [Commented] (FLINK-24428) Fix casting between interval types

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

Timo Walther commented on FLINK-24428:
--------------------------------------

fyi: a couple of subtasks in FLINK-12251 are related to intervals as well

> Fix casting between interval types
> ----------------------------------
>
>                 Key: FLINK-24428
>                 URL: https://issues.apache.org/jira/browse/FLINK-24428
>             Project: Flink
>          Issue Type: Sub-task
>            Reporter: Marios Trivyzas
>            Priority: Major
>
> * Cast from any interval type to *INTERVAL(YEAR())* currently always results in *INTERVAL(MONTH())* type
>  * Implement casting between INTERVAL types?
> Postgres:
> {{postgres=# select CAST('+41 10:17:36.789' AS INTERVAL DAY TO SECOND)::INTERVAL YEAR TO MONTH;}}
> {{ interval }}
> {{----------}}
> {{ 00:00:00}}
> {{(1 row)}}{{postgres=# select CAST('+01-05' AS INTERVAL YEAR TO MONTH);}}
> {{ interval }}
> {{---------------}}
> {{ 1 year 5 mons}}
> {{(1 row)}}{{postgres=# select CAST(CAST('+01-05' AS INTERVAL YEAR TO MONTH) AS INTERVAL DAY TO HOUR);}}
> {{ interval }}
> {{---------------}}
> {{ 1 year 5 mons}}
> {{(1 row)}}{{postgres=# select CAST(CAST('+01-05' AS INTERVAL YEAR TO MONTH) AS INTERVAL DAY TO SECOND);}}
> {{ interval }}
> {{---------------}}
> {{ 1 year 5 mons}}
> {{(1 row)}}
>  
> Oracle throws error if you try to switch between YEAR-MONTH to DAY-...SEC:
> {{select CAST(CAST('+52 10:17:36.789' AS INTERVAL DAY TO SECOND) AS INTERVAL YEAR TO MONTH) FROM DUAL;}}{{ORA-00932: inconsistent datatypes: expected INTERVAL YEAR TO MONTH got INTERVAL DAY TO SECOND}}
>  



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