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

ASF GitHub Bot commented on DRILL-3610:
---------------------------------------

vvysotskyi opened a new pull request #1527: DRILL-3610 & DRILL-4456 Fix 
TIMESTAMPADD, TIMESTAMPDIFF and Hive TRANSLATE functions
URL: https://github.com/apache/drill/pull/1527
 
 
   - In the first commit was added renaming of Hive `TRANSLATE` function to 
`TRANSLATE3` during function registration.
   
   - In the second commit was added type inference for `TIMESTAMPADD` function 
to avoid failures for the cases when function types are checked for expressions 
before and after rewriting.
   - Added custom convertlet for `TIMESTAMPDIFF` function to avoid rewriting it 
by Calcite, since Drill does not support `Reinterpret` function and does not 
handle all Calcite interval representations correctly.
   - Added UDFs for `TIMESTAMPDIFF` for all supported time units. The mechanism 
is similar to the existing `EXTRACT` function: when Calcite `RexCall` is 
converted to the Drill `LogicalExpression`, a function name is changed to 
`timestampdiffSecond` or similar one depending on the specified time unit.
   
   For problem descriptions please see 
[DRILL-3610](https://issues.apache.org/jira/browse/DRILL-3610) and 
[DRILL-4456](https://issues.apache.org/jira/browse/DRILL-4456).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> 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-impacting
>             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