trinodb/trino

Support cast from varchar to day-time interval type

開放

#4,697 建立於 2020年8月5日

 (4 則留言) (0 個反應) (0 位負責人)Java (2,678 個分叉)batch import
enhancementgood first issue

倉庫指標

星標
 (9,113 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

From the SQL spec:

20) If TD is interval, then
    [...]
    b) If SD is character string, then SV is replaced by

        TRIM ( BOTH ' ' FROM VE )

    Case:
        i) If the rules for <literal> or for <unquoted interval string> in Subclause 5.3, “<literal>”, can be applied to SV to 
           determine a valid value of the data type TD, then let TV be that value.
        ii) Otherwise, an exception condition is raised: data exception — invalid interval format.

and

<unquoted interval string> ::= [ <sign> ] { <year-month literal> | <day-time literal> }

<day-time literal> ::= 
    <day-time interval>
  | <time interval>

<day-time interval> ::=
   <days value> [ <space> <hours value> [ <colon> <minutes value>  [ <colon> <seconds value> ] ] ]

<time interval> ::=
    <hours value> [ <colon> <minutes value> [ <colon> <seconds value> ] ]
  | <minutes value> [ <colon> <seconds value> ]
  | <seconds value>

(only the <day-time literal> part of <unquoted interval string> applies to day-time intervals.

貢獻者指南