This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new b95f6d691cb5 [MINOR][DOCS] The default fractional numeric literal in 
SQL is a decimal
b95f6d691cb5 is described below

commit b95f6d691cb5796778b18371335799135f08cca7
Author: Nicholas Chammas <[email protected]>
AuthorDate: Mon Feb 5 14:56:52 2024 +0900

    [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]>
---
 docs/sql-ref-literals.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/docs/sql-ref-literals.md b/docs/sql-ref-literals.md
index 2a02a22bd6f0..e794287da9ce 100644
--- a/docs/sql-ref-literals.md
+++ b/docs/sql-ref-literals.md
@@ -275,6 +275,10 @@ E [ + | - ] digit [ ... ]
 
     Case insensitive, indicates `DECIMAL`, with the total number of digits as 
precision and the number of digits to right of decimal point as scale.
 
+* **default (no postfix)**
+
+    Indicates `DECIMAL`, same as the `BD` postfix.
+
 #### Fractional Literals Examples
 
 ```sql


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to