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 合并指标
 (平均合并 5天 9小时) (30 天内合并 306 个 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.

贡献者指南