INTERVAL 1 WEEK in SQL is wrong interval
- Dominant language
- Java
- Stars
- 14.1k
- Forks
- 3.8k
- Avg merge
- 2d 58m
- Merged PRs (30d)
- 233
Description
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 WEEK,
MILLIS_TO_TIMESTAMP(0) + INTERVAL 2 WEEK
```
Expected Results:
```
EXPR$0,EXPR$1
1970-01-08T00:00:00.000Z,1970-01-15T00:00:00.000Z
```
Actual Results:
```
EXPR$0,EXPR$1
1970-01-01T01:00:00.000Z,1970-01-01T02:00:00.000Z
```
Contributor guide
Research direction
Start in the Unified Console Workbench by running the SQL query from the issue and comparing both interval results with the expected timestamps. Trace how Druid interprets WEEK intervals, then verify that INTERVAL 1 WEEK and INTERVAL 2 WEEK produce seven- and fourteen-day offsets rather than one- and two-hour offsets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100