andygrove opened a new pull request, #2912: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2912
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. `SparkSqlDialect` reads every suffix except an uppercase `L` as a column alias: ```sql SELECT 1D, 1.5BD, 10Y, 1l -- today: SELECT 1 AS D, 1.5 AS BD, 10 AS Y, 1 AS l ``` This adds `Dialect::supports_numeric_literal_suffixes`, enabled for Spark. The tokenizer then reads `Y`, `S`, `F`, `D` and `BD` into a new `Token::SuffixedNumber`, which parses to `Value::SuffixedNumber(String, NumberSuffix)`. An `L` in either case still gives `Value::Number(_, true)`. As in Spark, `L`, `S` and `Y` only follow an integer, and a suffix directly followed by an identifier character, as in `1Dx`, is not one. Other dialects are unchanged. Spark docs: https://spark.apache.org/docs/latest/sql-ref-literals.html#numeric-literal This PR was prepared with AI assistance (Claude). <!-- comma separated, or `none` --> Dialects: Spark -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
