waterWang opened a new pull request, #19906: URL: https://github.com/apache/druid/pull/19906
### Description Fixes #18665 `INTERVAL 1 WEEK` in SQL resolves to `PT1H` (1 hour) instead of `P7D` (7 days). ```sql SELECT MILLIS_TO_TIMESTAMP(0) + INTERVAL 1 WEEK ``` Returns `1970-01-01T01:00:00.000Z` instead of `1970-01-08T00:00:00.000Z`. ### Root Cause Calcite has a known quirk where WEEK interval literals are stored as 1 hour in the `INTERVAL_DAY_TIME` family. The `INTERVAL 1 WEEK` literal's `RexLiteral.value()` returns `3600000` (1 hour in ms) instead of `604800000` (7 days in ms). ### Fix In `calciteLiteralToDruidLiteral`, detect the `WEEK` qualifier on the `SqlIntervalQualifier` and multiply the stored millisecond value by 7 × 24 to convert from the incorrect 1-hour representation to the correct 7-day duration. ### Impact All `INTERVAL N WEEK` expressions now correctly resolve to N weeks instead of N hours. The fix applies to all contexts where `INTERVAL_DAY_TIME` literals are converted to Druid expressions: timestamp arithmetic (`+`/`-`), `TIMESTAMPDIFF`, and other interval-using operations. ### Verification ```sql SELECT MILLIS_TO_TIMESTAMP(0) + INTERVAL 1 WEEK -- Before: 1970-01-01T01:00:00.000Z -- After: 1970-01-08T00: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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
