Time_floor behaviour with PT2H

Hi Team,

We are trying to roll down data for every 2hrs using time_floor function. If I perform the roll down on datapoint that is at 10.07 AM it rolls down to nearest multiple of 2hrs which is 10 AM. How can I make it roll down to 9 AM ?

use case 9 AM to 11 AM data should be rolled down to 9AM, using time_floor it always rolls down to 10AM.

Any suggestions would be really appreciated !


Can you send over the spec that you are using to do the roll down?

Oh are you seeing that PT2H is just bringing it down to the nearest even hour? 8am 10am, 12pm, 2pm… etc? I believe they’re ISO 8601 durations in TIME_FLOOR [https://druid.apache.org/docs/latest/querying/sql.html#time-functions] - perhaps dig further into that? Or could you achieve it using some kind of calculation?