feat: add Teradata dialect - #3075
Conversation
be0c629 to
3d7efa8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d7efa8c86
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| dialect.patch_lexer_matchers(vec![Matcher::regex( | ||
| "numeric_literal", | ||
| r"([0-9]+(\.[0-9]*)?)", | ||
| SyntaxKind::NumericLiteral, | ||
| )]); |
There was a problem hiding this comment.
Preserve scientific and leading-dot numeric literals
When Teradata SQL contains valid numeric forms such as 1e-9, 25e-03, or .0123E-6, this override replaces the inherited ANSI matcher—which supports exponents and leading decimal points—with a regex accepting only digits followed by an optional decimal fraction. The lexer consequently splits these values into multiple tokens and leaves the statement unparsable; retain the native matcher or extend this regex to cover those forms.
Useful? React with 👍 / 👎.
Benchmark for 9e2658bClick to view benchmark
|
Benchmark for d446253Click to view benchmark
|
What changed
teradataas a first-class dialect and default crate featureQUALIFY,NORMALIZE,TOP, query-band, session, and Teradata cast grammars from SQLFluff.sqlfluff-sha(d8943f041dd53ab6b7c018e46b81c32dfd65b682) and generate Sqruff parse-tree expectationsWhy
Sqruff did not expose a Teradata dialect, so Teradata-specific statements and expressions either required another dialect or produced unparsable segments. This port makes the pinned SQLFluff Teradata surface available through
dialect = teradata.Validation
cargo fmt --all -- --checkcargo test -p sqruff-lib-dialects --test dialects -- teradata(24 fixture files)cargo clippy -p sqruff-lib-dialects --all-features -- -D warningsd8943f0…revision