Re: Rrounding timestamps to nearest period interval

2015-07-16 Thread Stefán Baxter
Thank you Christopher I will build my workaround on this. -Stefan On Wed, Jul 15, 2015 at 8:49 PM, Christopher Matta cma...@mapr.com wrote: I did this last week with a query on the Drill profiles, this query will break down the number of queries in 5 minute increments: select x.`timestamp`,

Rrounding timestamps to nearest period interval

2015-07-15 Thread Stefán Baxter
Hi, I don't seem to find a handy way to round timestamps to nearest period interval (PT5M / PT15M) and DATE_DIFF seems to be missing for simple calculation of it. It seems like a too common use case for me to write a UDF for it but if it's missing then we will happily contribute a simple

Re: Rrounding timestamps to nearest period interval

2015-07-15 Thread Mehant Baid
Hey Stefan, Could you clarify with an example what is the input and expected output for the UDF you are looking for. Thanks Mehant On 7/15/15 11:59 AM, Stefán Baxter wrote: Hi, I don't seem to find a handy way to round timestamps to nearest period interval (PT5M / PT15M) and DATE_DIFF

Re: Rrounding timestamps to nearest period interval

2015-07-15 Thread Stefán Baxter
Hi, This is used to group on time periods (minutes, hour of day, four-hour-groups-per-day etc). Ceiling to nearest 15 minutes interval (PT15M) then Looking at time without mills: 2015-07-15T00:07:00 becomes 2015-07-15T00:15:00 2015-07-15T00:16:00 becomes 2015-07-15T00:30:00 2015-07-15T01:59:00

Re: Rrounding timestamps to nearest period interval

2015-07-15 Thread Christopher Matta
I did this last week with a query on the Drill profiles, this query will break down the number of queries in 5 minute increments: select x.`timestamp`, x.`user`, count(1) from ( select t.`user`, to_timestamp(((cast(t.`start` as bigint)/1000) - MOD((cast(t.`start` as bigint)/1000),