Repository navigation
Conversation
Spark SQL types a numeric literal by a case-insensitive suffix: `Y`, `S` and `L` after an integer, and `F`, `D` and `BD` after any number. The tokenizer read `1D` as the number `1` followed by the alias `D`.
…ber's text Instead of a NumberSuffix enum and new Token and Value variants, the tokenizer asks Dialect::is_numeric_literal_suffix about the identifier characters after a number and keeps an accepted suffix in the Token::Number text. Spark, Databricks, Hive and Oracle each list their own suffixes.
andygrove
marked this pull request as ready for review
November 11, 2026 19:43
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2912 +/- ##
==========================================
+ Coverage 83.20% 83.24% +0.03%
==========================================
Files 42 42
Lines 36471 36536 +65
Branches 36471 36536 +65
==========================================
+ Hits 30345 30413 +68
Misses 2632 2632
+ Partials 3494 3491 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Spark, Databricks and Hive give a numeric literal a type with a case-insensitive suffix, such as
10Yor1.5BD, and Oracle hasFandD. sqlparser reads the suffix as a column alias, or, in Databricks and Hive, the whole literal as a column name:This adds
Dialect::is_numeric_literal_suffix(number, suffix), which the tokenizer asks about the identifier characters directly after a number. An accepted suffix stays in the number's text, as inValue::Number("10Y", false), except thatLin either case still sets the long flag. The dialects accept:L,S,Yafter an integer,F,D,BDafter any numberL,S,Yafter an integer,D,BDafter any numberF,Dafter any numberA suffix must end the word, so
1Dxis unchanged, and in Databricks and Hivet.1Dand1Lastay column names. This also covers the1Lof #2771. Other dialects are unchanged. With thebigdecimalfeature, a number with a suffix fails to parse, since aBigDecimalcan't hold it.Docs: Spark, Databricks, Hive's lexer, Oracle
This PR was prepared with AI assistance (Claude).
Dialects: Spark, Databricks, Hive, Oracle