You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Fucun Chu (Jira)" <ji...@apache.org> on 2021/08/05 23:43:00 UTC

[jira] [Commented] (IMPALA-10830) Trunc function to support minute intervals

    [ 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-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org