Skip to content

fix(tests)!: make typed temporal test literals unquoted#1064

Open
benbellick wants to merge 3 commits intomainfrom
fix/test-format-quoted-string-literals
Open

fix(tests)!: make typed temporal test literals unquoted#1064
benbellick wants to merge 3 commits intomainfrom
fix/test-format-quoted-string-literals

Conversation

@benbellick
Copy link
Copy Markdown
Member

@benbellick benbellick commented Apr 30, 2026

Quoted date/time-shaped values are ambiguous in the test grammar. The old lexer matched values like '2020-05-10' as DateLiteral before the parser could see that the argument was annotated as ::str.

This resulted in cases like identity('2020-05-10'::str) = '2020-05-10'::str failing to parse with mismatched input 'str' expecting 'DATE'. Because '2020-05-10' is lexed as DateLiteral instead of StringLiteral, it fails the stringArg rule:

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:

lt('2020-12-30'::date, '2020-12-31'::date) = true::bool

instead become:

lt(2020-12-30::date, 2020-12-31::date) = true::bool

Existing datetime tests have been updated to use the unquoted form.

Alternatives

I first tried adding a shared quotedLiteral parser rule and allowing stringArg to 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 Reviewable

@benbellick benbellick changed the title fix: allow type-shaped strings in scalar function tests fix: make typed temporal test literals unquoted Apr 30, 2026
@benbellick benbellick changed the title fix: make typed temporal test literals unquoted fix(tests)!: make typed temporal test literals unquoted Apr 30, 2026
@benbellick benbellick marked this pull request as ready for review April 30, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant