Hi, if I have some pinot sql related question shal...
# general
y
Hi, if I have some pinot sql related question shall I ask in this channel? does pinot sql support group by time interval? such as if I want to group by 2 days etc... now my query only supports one day
m
Typically, you want to ask questions in #C011C9JHN7R. You should be able to group by a transform function that converts your time column into 2 day buckets.
👍 1
y
Hi, @Mayank I tried two ways but seems it doesn't work as expected, one way is I use date_part, and group by year, month... another way is I use unix timestamp, but seems both ways doesn't work as expected, am I using the right way? I said it doesn't work as expected, the aggregation results only return partial data query
Copy code
select org_uuid, event_type, from_unixtime(updated_at / 3600 * 3600), count(*) from table
where org_uuid = 'x'
group by 1, 2 ,3
another
Copy code
select org_uuid, event_type, 
    DATE_PART('YEAR', date_parse(updated_at_string, '%Y-%m-%d %H:%i:%s')) as _year,
    DATE_PART('MONTH', date_parse(updated_at_string, '%Y-%m-%d %H:%i:%s')) as _month,
    DATE_PART('DAY', date_parse(updated_at_string, '%Y-%m-%d %H:%i:%s')) as _day,
    DATE_PART('HOUR', date_parse(updated_at_string, '%Y-%m-%d %H:%i:%s')) as _hour,
    count(*) from table
where org_uuid = 'x'
group by 1, 2, 
 3,
 4,
 5,
6
based in my company, seems they only support aggregate by
date_trunc
so I can only aggregate by unit
m
Ok, yes, did you try with date_trunc? And did it work?
y
yes that works, but use
date_trunc
it only allow me aggregate by one time unit(hour, day...) but if I want to to timewindow, such as 3 hours, 4 days etc, looks like I cannot use group by