You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "JRobTS (via GitHub)" <gi...@apache.org> on 2025/10/20 20:19:28 UTC

[I] INTERVAL 1 WEEK in Druid is wrong interval (druid)

JRobTS opened a new issue, #18665:
URL: https://github.com/apache/druid/issues/18665

   The `INTERVAL 1 WEEK` syntax in SQL is resolving to `PT1H`.
   
   ### Affected Version
   
   Found in Apache Druid 33.0.0
   
   ### Description
   
   Most easily detected by running this SQL query in Unified Console Workbench:
   ```
   SELECT MILLIS_TO_TIMESTAMP(0) + INTERVAL 1 HOUR, 
     MILLIS_TO_TIMESTAMP(0) + INTERVAL 1 DAY, 
     MILLIS_TO_TIMESTAMP(0) + INTERVAL 7 DAY, 
     MILLIS_TO_TIMESTAMP(0) + INTERVAL 14 DAY, 
     MILLIS_TO_TIMESTAMP(0) + INTERVAL 1 WEEK,
     MILLIS_TO_TIMESTAMP(0) + INTERVAL 2 WEEK
   ```
   Expected Results:
   ```
   EXPR$0,EXPR$1,EXPR$2,EXPR$3,EXPR$4,EXPR$5
   1970-01-01T01:00:00.000Z,1970-01-02T00:00:00.000Z,1970-01-08T00:00:00.000Z,1970-01-15T00:00:00.000Z,1970-01-08T00:00:00.000Z,1970-01-15T00:00:00.000Z
   ```
   Actual Results:
   ```
   EXPR$0,EXPR$1,EXPR$2,EXPR$3,EXPR$4,EXPR$5
   1970-01-01T01:00:00.000Z,1970-01-02T00:00:00.000Z,1970-01-08T00:00:00.000Z,1970-01-15T00:00:00.000Z,1970-01-01T01:00:00.000Z,1970-01-01T02:00:00.000Z
   ```
   
   


-- 
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.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: [I] INTERVAL 1 WEEK in SQL is wrong interval (druid)

Posted by "christian-schlichtherle (via GitHub)" <gi...@apache.org>.
christian-schlichtherle commented on issue #18665:
URL: https://github.com/apache/druid/issues/18665#issuecomment-3877006260

   Just ran into the same problem on Druid 34.0.0:
   
   ````
   SELECT
     CURRENT_TIMESTAMP AS now,
     CURRENT_TIMESTAMP - INTERVAL '7' DAYS AS last_week_correct,
     CURRENT_TIMESTAMP - INTERVAL '1' WEEK AS last_week_wrong
   ```


-- 
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: [I] INTERVAL 1 WEEK in SQL is wrong interval (druid)

Posted by "barry3406 (via GitHub)" <gi...@apache.org>.
barry3406 commented on issue #18665:
URL: https://github.com/apache/druid/issues/18665#issuecomment-4228251733

   I can repro on Druid 34.0.0 — `INTERVAL '1' WEEK` resolves to `PT1H` instead of `P7D`. Looks like the WEEK unit is missing from the Calcite-to-Druid interval conversion (most other units land in the day path but WEEK falls through to hours). Going to dig in and send a PR with a SqlIntervalArithmeticTest covering WEEK alongside the existing DAY/MONTH cases.


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