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

Fucun Chu commented on IMPALA-10830:
------------------------------------

date by 5 minute Interval: 
{code:java}
SELECT from_unixtime(cast(300 * floor(unixtime / 300) AS BIGINT)) as 5min FROM 
( SELECT unix_timestamp(now()) unixtime ) t;{code}

> Trunc function to support minute intervals
> ------------------------------------------
>
>                 Key: IMPALA-10830
>                 URL: https://issues.apache.org/jira/browse/IMPALA-10830
>             Project: IMPALA
>          Issue Type: New Feature
>          Components: Frontend
>    Affects Versions: 4/
>            Reporter: Manish Maheshwari
>            Priority: Major
>
> We support rounding into minute intervals. 
> {code:java}
> select trunc(now(), 'MI') ;
> Query submitted at: 2021-07-28 05:27:48 (Coordinator: 
> https://demo-coordinator0.se-sandb.a465-9q4k.cloudera.site:25000)
> Query progress can be monitored at: 
> https://demo-coordinator0.se-sandb.a465-9q4k.cloudera.site:25000/query_plan?query_id=694ca74fd48c06b3:0c0e51f200000000
> 2021-07-28 05:27:00
>  {code}
> We also need to support rounding into custom intervals like 5/10/15/30 etc 
> minutes. If can add `MIxx` or `HHxx` that would be ideal.
> Current workaround is a very untidy 
> {code:java}
> to_timestamp(concat( FROM_TIMESTAMP(ts, 'yyyy-MM-dd HH'), ':', lpad( cast ( 
> trunc(minute(ts)/5.0)*5 as string), 2, '0') ) , 'yyyy-MM-dd HH:mm') as 
> aggegrate_5min_ts {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to