Skip to content

Parse typed SQL literals and null modifiers - #16

Draft
nickapopolis wants to merge 1 commit into
ClickHouse:mainfrom
nickapopolis:nickapopolis/typed-sql-literals
Draft

Parse typed SQL literals and null modifiers#16
nickapopolis wants to merge 1 commit into
ClickHouse:mainfrom
nickapopolis:nickapopolis/typed-sql-literals

Conversation

@nickapopolis

Copy link
Copy Markdown

Summary

  • parse DATE and TIMESTAMP typed literals as atomic expressions
  • preserve type keywords and trivia in the CST
  • consume IGNORE NULLS / RESPECT NULLS correctly before window clauses
  • expose the new TypedLiteral kind through the TypeScript package

Motivation

ClickHouse queries commonly use typed date and timestamp bounds, including inside BETWEEN expressions. Treating the type keyword and string as separate expressions causes cascading recovery diagnostics. The existing null-modifier parser also consumed whitespace rather than NULLS, which became visible when a modifier was followed by OVER.

Testing

  • cargo test --quiet (544 tests passed)
  • exercised typed literals in projections, function arguments, and BETWEEN bounds
  • exercised mixed case and comments between the type and value
  • exercised IGNORE NULLS OVER (...)

Recognize DATE and TIMESTAMP literals as atomic expressions so ClickHouse queries using typed bounds parse without recovery. Also consume NULLS through trivia before window clauses instead of treating it as an alias.

Assisted-By: devx/4083d2ac-743f-4708-b519-0f1f5e71230d
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

2 participants