fix(tests)!: make typed temporal test literals unquoted#1064
Open
benbellick wants to merge 3 commits intomainfrom
Open
fix(tests)!: make typed temporal test literals unquoted#1064benbellick wants to merge 3 commits intomainfrom
benbellick wants to merge 3 commits intomainfrom
Conversation
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.
Quoted date/time-shaped values are ambiguous in the test grammar. The old lexer matched values like
'2020-05-10'asDateLiteralbefore the parser could see that the argument was annotated as::str.This resulted in cases like
identity('2020-05-10'::str) = '2020-05-10'::strfailing to parse withmismatched input 'str' expecting 'DATE'. Because'2020-05-10'is lexed asDateLiteralinstead ofStringLiteral, it fails thestringArgrule:stringArg : StringLiteral DoubleColon stringType ;To fix this, typed temporal and interval literals are now unquoted, so quoted values are always available as strings. Concretely, tests like:
instead become:
Existing datetime tests have been updated to use the unquoted form.
Alternatives
I first tried adding a shared
quotedLiteralparser rule and allowingstringArgto accept date/time/interval tokens. That was smaller and backwards compatible, but it left the grammar treating string arguments as date/time tokens in some cases. Making typed temporal literals unquoted removes the ambiguity instead.Breaking Change
I am unsure if this should be treated as breaking. It breaks the scalar function test format, but not the Substrait format itself.
Note: This PR was developed with AI assistance. All changes have been reviewed, and I take full responsibility for this contribution.
This change is