Repository navigation
fix: type a DATE plus INTERVAL 'n' DAY as TIMESTAMP_NTZ(9) - #118
Merged
Merged
Conversation
Snowflake keeps a DATE for INTERVAL '7 days', with the unit inside the quotes, but gives a TIMESTAMP_NTZ(9) at midnight for INTERVAL '3' DAY, with the unit after them. The second spelling converted as a DATE.
Contributor
Author
|
D94 gate on 893cb9d (based on main 37e3767):
|
kvlonge
added a commit
that referenced
this pull request
Nov 6, 2026
…_NTZ(9) approved with two notes
INTERVAL 3 DAY parses as INTERVAL '3' DAY, but no recording shows how Snowflake types it, so DATE or timestamp arithmetic with an unquoted interval value now refuses.
kvlonge
added a commit
that referenced
this pull request
Nov 6, 2026
With main merged, the conversion constants file reached 2,005 lines, over the 2,000-line limit. The refusal reason now sits in intervals.rs like the other interval refusals, and the keyword check reuses INTERVAL_KIND.
Contributor
Author
|
Landing gate at 50e3efb (main 4b6278d merged):
Merging main pushed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Snowflake types a DATE plus an interval differently depending on where the unit is written.
d - INTERVAL '7 days', with the unit inside the quotes, stays a DATE (recorded in temporal/interval_arithmetic.toml).d + INTERVAL '3' DAYandINTERVAL '3' DAYS, with the unit after the quotes, give a TIMESTAMP_NTZ(9) at midnight (recorded in translation data-types-datetime.interval t003_plural). The second spelling converted as a DATE, which changes the column's type and how it compares downstream.Changes
INTERVAL 'n' DAY(S)with the unit after the quotes now gives TIMESTAMP_NTZ(9) at midnight plus the days, relying on timestamp_range, as for a timestamp operand. The quoted-unit spelling keeps a DATE.Verification
'2026-04-01'::DATE + INTERVAL '3' DAYSgives2026-04-04 00:00:00.000(it gave2026-04-04before the fix), and- INTERVAL '1' DAYacross a leap day; the existing quoted-unit DATE case is unchanged.make check-ci,make test-rust,make verify-recorded.