-
Notifications
You must be signed in to change notification settings - Fork 28.5k
[SPARK-22036][SQL][FOLLOWUP] Fix decimalArithmeticOperations.sql #20498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test build #87029 has finished for PR 20498 at commit
|
retest this please. |
@@ -49,7 +49,7 @@ select 1e35 / 0.1; | |||
|
|||
-- arithmetic operations causing a precision loss are truncated | |||
select 123456789123456789.1234567890 * 1.123456789123456789; | |||
select 0.001 / 9876543210987654321098765432109876543.2 | |||
select 0.001 / 9876543210987654321098765432109876543.2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @wangyum .
If this is only for a specific test file, can we have more proper title? Fix decimalArithmeticOperations.sql
?
Test build #87034 has finished for PR 20498 at commit
|
Test build #87035 has finished for PR 20498 at commit
|
@@ -49,7 +49,7 @@ select 1e35 / 0.1; | |||
|
|||
-- arithmetic operations causing a precision loss are truncated | |||
select 123456789123456789.1234567890 * 1.123456789123456789; | |||
select 0.001 / 9876543210987654321098765432109876543.2 | |||
select 0.001 / 9876543210987654321098765432109876543.2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... A good catch! We need to review the PR more carefully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a good test case. The results and schemas are the same no matter whether we set spark.sql.decimalOperations.allowPrecisionLoss
to true or false.
@mgaido91 We just remove this test case? I think we can still keep it, right? |
@gatorsmile because this is an example of overflow, ie. what is covered in the new PR: in the new PR I added many tests for this case, so I felt this unnecessary. |
@mgaido91 If we remove it, we still need test cases for verifying the effects of |
@gatorsmile yes, I see what you mean, we should keep it to check that changing |
If possible, I prefer to doing it in this PR. We should merge this test-only PR to 2.3 and master for verifying the behavior of the changes made in 2.3. |
Yes sure,I'll rebase my PR after this is merged. |
Test build #87041 has finished for PR 20498 at commit
|
@@ -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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
LGTM |
Test build #87050 has finished for PR 20498 at commit
|
LGTM Thanks! Merged to master/2.3! |
## What changes were proposed in this pull request? Fix decimalArithmeticOperations.sql test ## How was this patch tested? N/A Author: Yuming Wang <wgyumg@gmail.com> Author: wangyum <wgyumg@gmail.com> Author: Yuming Wang <yumwang@ebay.com> Closes #20498 from wangyum/SPARK-22036. (cherry picked from commit 6fb3fd1) Signed-off-by: gatorsmile <gatorsmile@gmail.com>
What changes were proposed in this pull request?
Fix decimalArithmeticOperations.sql test
How was this patch tested?
N/A