Skip to content

Commit b95f6d6

Browse files
nchammasHyukjinKwon
authored andcommitted
[MINOR][DOCS] The default fractional numeric literal in SQL is a decimal
### What changes were proposed in this pull request? Explain that a number like `123.456`, without a postfix but with a decimal point, is a decimal literal. ### Why are the changes needed? In Python (and I think Java too) fractional numeric literals are typically floats. To get decimals, you need to provide an explicit postfix or use an explicit class. In Spark, it's the other way around. I found this surprising and couldn't find documentation about it. I discovered this after reading SPARK-45786. I did a little searching and came across #10796, which shows that we used to default to floats as the fractional numeric literal, but then switched to decimals. ### Does this PR introduce _any_ user-facing change? Yes, it adds a bit of documentation. ### How was this patch tested? No testing. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #45003 from nchammas/decimal-literal. Authored-by: Nicholas Chammas <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
1 parent 1e13d8d commit b95f6d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/sql-ref-literals.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ E [ + | - ] digit [ ... ]
275275
276276
Case insensitive, indicates `DECIMAL`, with the total number of digits as precision and the number of digits to right of decimal point as scale.
277277
278+
* **default (no postfix)**
279+
280+
Indicates `DECIMAL`, same as the `BD` postfix.
281+
278282
#### Fractional Literals Examples
279283
280284
```sql

0 commit comments

Comments
 (0)