You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "benhopp (via GitHub)" <gi...@apache.org> on 2026/04/27 21:45:29 UTC

[PR] Fix hang in PeriodGranularity when using sub-day compound periods with imprecise timezone days (druid)

benhopp opened a new pull request, #19382:
URL: https://github.com/apache/druid/pull/19382

   Fixes a bug where timestamp_floor with compound time-only periods falls back to an infinite loop when the timezone has daylight saving time.
   
   ### Description
   The issue is caused by how Druid's PeriodGranularity attempts to bucket timestamps when timezones and daylight saving time (DST) are involved. 
   
   When trying to bucket timestamps using a compound period like PT1M1S, Druid first tries a fast-path (`truncateMillisPeriod`). It checks if the timezone has precise days and hours. Because timezones with DST (like `America/New_York`) observe daylight saving time, Druid incorrectly flags the timezone as imprecise for all period durations. It then falls back to a slow-path (`truncateCompoundPeriod`), which literally runs a while loop, adding the period duration starting from January 1st, 1970, until it reaches the target timestamp. This means it loops over 28 million times for every single row in the query, causing it to hang.
   
   This PR updates the `truncateMillisPeriod` logic to check if the period contains any inherently imprecise components like years, months, weeks, or days. If the period only contains hours, minutes, seconds, or milliseconds, it will safely convert the period to milliseconds and use the fast-path modulo math, avoiding the infinite while loop completely.
   
   A regression test `PeriodGranularityBugTest.java` is included to validate this fix.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] fix: hang in PeriodGranularity when using sub-day compound periods with imprecise timezone days (druid)

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #19382:
URL: https://github.com/apache/druid/pull/19382#issuecomment-4823602898

   This pull request has been marked as stale due to 60 days of inactivity.
   It will be closed in 4 weeks if no further activity occurs. If you think
   that's incorrect or this pull request should instead be reviewed, please simply
   write any comment. Even if closed, you can still revive the PR at any time or
   discuss it on the dev@druid.apache.org list.
   Thank you for your contributions.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] fix: hang in PeriodGranularity when using sub-day compound periods with imprecise timezone days (druid)

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #19382: fix: hang in PeriodGranularity when using sub-day compound periods with imprecise timezone days
URL: https://github.com/apache/druid/pull/19382


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Re: [PR] fix: hang in PeriodGranularity when using sub-day compound periods with imprecise timezone days (druid)

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #19382:
URL: https://github.com/apache/druid/pull/19382#issuecomment-5086215108

   This pull request/issue has been closed due to lack of activity. If you think that
   is incorrect, or the pull request requires review, you can revive the PR at any time.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org