[CALCITE-7559] SqlParserUtil.parseTimeTzLiteral should reject unknown…#4986
Open
OldTruckDriver wants to merge 1 commit into
Open
[CALCITE-7559] SqlParserUtil.parseTimeTzLiteral should reject unknown…#4986OldTruckDriver wants to merge 1 commit into
OldTruckDriver wants to merge 1 commit into
Conversation
xuzifu666
reviewed
Jun 3, 2026
| } | ||
| } | ||
|
|
||
| @Test void testTimeWithTimeZone() { |
Member
There was a problem hiding this comment.
You'd better add jira link here which show Jira this test is trying to solve.
Contributor
There was a problem hiding this comment.
yes, please see other examples for the formatting used for JIRA test cases.
| } catch (DateTimeException e) { | ||
| String message = e.getMessage(); | ||
| if (message == null) { | ||
| message = "Error parsing TIME ZONE"; |
Member
There was a problem hiding this comment.
Improper capitalization => "Error parsing timezone"
Contributor
There was a problem hiding this comment.
I actually think this is fine, since this is how the SQL type is spelled
| message = "Error parsing TIME ZONE"; | ||
| } | ||
| throw SqlUtil.newContextException(pos, | ||
| RESOURCE.illegalLiteral("TIME WITH TIME ZONE", s, message)); |
mihaibudiu
approved these changes
Jun 3, 2026
Contributor
mihaibudiu
left a comment
There was a problem hiding this comment.
This is good, but please add the JIRA link as suggested. No need for a new commit, since this is a small PR, we'll just merge once you update.
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.
SqlParserUtil.parseTimeTzLiteral(...)usedTimeZone.getTimeZone(String), which silently falls back to GMT for unknown zone IDs, so invalidTIME WITH TIME ZONEliterals were accepted instead of rejected. The siblingparseTimestampTzLiteral(...)already validates the zone viaZoneId.of(...).This applies the same pattern as CALCITE-7527: validate the zone with
ZoneId.of(...)and throw aCalciteContextExceptionon an invalid zone, making the two paths consistent.Added
SqlParserUtilTest.testTimeWithTimeZonecovering a valid zone, an unknown zone, and a missing zone.