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

Julian Hyde commented on OPTIQ-304:
-----------------------------------

I pointed to the SO article because they realized there was a problem and came 
up with some awful attempts at solutions using extract, not because they solved 
it.

Extract doesn't do the job because you have to extract all of the units (e.g. 
hours, minutes, seconds) and add them with multipliers. Whereas you can just 
convert a interval to the time unit you want, then convert that to a number.

{{cast(cast(x as interval second) as integer))}}

or if you want minutes

{{cast(cast(x as interval minute) as integer))}}

> Support '<DATE> + <INTEGER>' operator
> -------------------------------------
>
>                 Key: OPTIQ-304
>                 URL: https://issues.apache.org/jira/browse/OPTIQ-304
>             Project: optiq
>          Issue Type: Bug
>            Reporter: Julian Hyde
>
> We should support '<DATE> + <INTEGER>' operator. I'm not sure whether it is 
> standard SQL, but it occurs in TPC-DS (query 72).
> Note that {{d + n}} is equivalent to {{d + interval n day}} if {{n}} is a 
> constant.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to