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

Volodymyr Vysotskyi commented on DRILL-3610:
--------------------------------------------

Hi, [~bbevens],

There are some inaccuracies in docs. 
 {{TIMESTAMPADD(time_unit,interval, keyword date_expression)}} is not quite 
right. {{TIMESTAMPADD}} require the last argument value (or a column) of date, 
time or timestamp type. In the case of literal, {{date '2003-01-02'}} gives us 
date literal, it is not connected with UDF itself.
The more general use case is
 {{TIMESTAMPADD(time_unit,interval, date_time_col)}}, where date_time_col has 
one the following types: date, time, or timestamp. The same for 
{{TIMESTAMPDIFF}} function.

Could you please correct docs to clarify that?

> TimestampAdd/Diff (SQL_TSI_) functions
> --------------------------------------
>
>                 Key: DRILL-3610
>                 URL: https://issues.apache.org/jira/browse/DRILL-3610
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Functions - Drill
>            Reporter: Andries Engelbrecht
>            Assignee: Volodymyr Vysotskyi
>            Priority: Major
>              Labels: doc-complete, ready-to-commit
>             Fix For: 1.15.0
>
>
> Add TimestampAdd and TimestampDiff (SQL_TSI) functions for year, quarter, 
> month, week, day, hour, minute, second.
> Examples
> SELECT CAST(TIMESTAMPADD(SQL_TSI_QUARTER,1,Date('2013-03-31'), SQL_DATE) AS 
> `column_quarter`
> FROM `table_in`
> HAVING (COUNT(1) > 0)
> SELECT `table_in`.`datetime` AS `column1`,
>   `table`.`Key` AS `column_Key`,
>   TIMESTAMPDIFF(SQL_TSI_MINUTE,to_timestamp('2004-07-04', 
> 'yyyy-MM-dd'),`table_in`.`datetime`) AS `sum_datediff_minute`
> FROM `calcs`



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to