Github user wangyum commented on a diff in the pull request:
https://github.com/apache/spark/pull/20498#discussion_r165844386
--- Diff:
sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/decimalArithmeticOperations.sql
---
@@ -48,8 +48,9 @@ select 12345678901234567890.0 * 12345678901234567890.0;
select 1e35 / 0.1;
-- arithmetic operations causing a precision loss are truncated
+select 12345678912345678912345678912.1234567 +
9999999999999999999999999999999.12345;
--- End diff --
The result is:
```
-- !query 17
select 12345678912345678912345678912.1234567 +
9999999999999999999999999999999.12345
-- !query 17 schema
struct<(CAST(12345678912345678912345678912.1234567 AS DECIMAL(38,6)) +
CAST(9999999999999999999999999999999.12345 AS DECIMAL(38,6))):decimal(38,6)>
-- !query 17 output
10012345678912345678912345678911.246907
-- !query 18
select 123456789123456789.1234567890 * 1.123456789123456789
-- !query 18 schema
struct<(CAST(123456789123456789.1234567890 AS DECIMAL(36,18)) *
CAST(1.123456789123456789 AS DECIMAL(36,18))):decimal(38,18)>
-- !query 18 output
138698367904130467.654320988515622621
-- !query 19
select 12345678912345.123456789123 / 0.000000012345678
-- !query 19 schema
struct<(CAST(12345678912345.123456789123 AS DECIMAL(29,15)) /
CAST(1.2345678E-8 AS DECIMAL(29,15))):decimal(38,9)>
-- !query 19 output
1000000073899961059796.725866332
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]