trinodb/trino

Support cast from varchar to day-time interval type

オープン

#4,697 opened on 2020/08/05

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)Java (2,678 件のフォーク)batch import
enhancementgood first issue

Repository metrics

Stars
 (9,113 個のスター)
PR merge metrics
 (平均マージ 5d 9h) (30d で 306 merged PRs)

説明

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.

コントリビューターガイド