You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/21 00:54:58 UTC
[GitHub] [spark] wangyum opened a new pull request #25214:
[SPARK-28461][SQL] Pad Decimal numbers with trailing zeros to the scale of
the column
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org