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