wangyum opened a new pull request #25214: [SPARK-28461][SQL] Pad Decimal 
numbers with trailing zeros to the scale of the column
URL: https://github.com/apache/spark/pull/25214
 
 
   ## What changes were proposed in this pull request?
   **Spark SQL**:
   ```sql
   spark-sql> select cast(1 as decimal(38, 18));
   1
   spark-sql>
   
   scala> spark.sql("select cast(1 as decimal(38, 18))").show(false)
   +-------------------------+
   |CAST(1 AS DECIMAL(38,18))|
   +-------------------------+
   |1.000000000000000000     |
   +-------------------------+
   ```
   
   **PostgreSQL**:
   ```sql
   postgres=# select cast(1 as decimal(38, 18));
          numeric
   ----------------------
    1.000000000000000000
   (1 row)
   ```
   **Presto**:
   ```sql
   presto> select cast(1 as decimal(38, 18));
           _col0
   ----------------------
    1.000000000000000000
   (1 row)
   ```
   
   Hive fixed this issue by 
[HIVE-12063](https://issues.apache.org/jira/browse/HIVE-12063). This pr fix 
this issue. After this pr:
   ```sql
   spark-sql> select cast(1 as decimal(38, 18));
   1.000000000000000000
   ```
   
   ## How was this patch tested?
   
   unit tests
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to