gianm opened a new issue #7777: timestamp_ceil function is either wrong or 
misleading
URL: https://github.com/apache/incubator-druid/issues/7777
 
 
   ### Affected Version
   
   0.14.2
   
   ### Description
   
   `SELECT CEIL(TIMESTAMP '2000-01-01 00:00:00' TO DAY)` returns 
`2000-01-02T00:00:00.000Z`, but `2000-01-01T00:00:00.000Z` would make more 
sense.
   
   This happens because what `CEIL(<timestamp> TO Y)` does is return the 
(exclusive) upper bound of the time bucket that includes `<timestamp>`. In 
particular, because it's exclusive, it will never be equal to the timestamp. If 
you pass in something that is at the bottom end of a bucket then you'll get the 
start of the next bucket.
   
   The function doesn't seem to be standardized (at least I can't find docs on 
it as a standard SQL function anywhere) so I guess it can behave however we 
want. IMO the current behavior is a bit weird, since it's non-idempotent. So it 
would make more sense to special case it so it returns the provided timestamp 
if that timestamp is already the upper bound of a time bucket.
   
   Original discussion: 
https://groups.google.com/d/topic/druid-user/199ADDTT08Q/discussion

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to