-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-28461][SQL] Pad Decimal numbers with trailing zeros to the scale of the column #26697
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
|
retest this please |
|
Thank you, @wangyum ! |
|
Thanks @dongjoon-hyun and @wangyum |
HyukjinKwon
left a comment
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.
Looks good if tests pass
|
Test build #114555 has finished for PR 26697 at commit
|
|
Test build #114557 has finished for PR 26697 at commit
|
|
I saw the exact failure in another PR, too. Let's re-trigger after midnight (PST). |
|
retest this please |
|
Test build #114566 has finished for PR 26697 at commit
|
|
@shahidki31 Could you fix this issue: https://issues.apache.org/jira/browse/SPARK-30068? |
|
Thanks @wangyum. I will look into it. Not sure why it didn't fail earlier? |
|
@shahidki31 You can reproduce this issue by Github action: https://github.com/spark-thriftserver/spark/pull/1/checks?check_run_id=324625735 |
|
@wangyum I think I couldn't yet reproduce in my local. I will check again. It seems some issue with mocking HttpServletRequest. But there are tests (like AllExecutionPageSuite.scala) which does the same thing seems passing? spark/sql/core/src/test/scala/org/apache/spark/sql/execution/ui/AllExecutionsPageSuite.scala Line 54 in dde0d2f
|
|
Yes. I also couldn't reproduce it on my local machine, but I can reproduce it by Github actions. |
|
@wangyum I am not sure, why it is suddenly started failing. If it is a blocker, then we can revert the test for time being, I'll raise it again once found the root cause? |
|
retest this please |
|
Can we hold on for a moment? I am investigating the test failure at #26706. |
|
retest this please |
|
Test build #114594 has finished for PR 26697 at commit
|
|
Test build #114598 has finished for PR 26697 at commit
|
|
^ this test failure will be fixed together at #26710 |
|
retest this please |
|
Test build #114649 has finished for PR 26697 at commit
|
|
retest this please |
|
Test build #114657 has finished for PR 26697 at commit
|
|
retest this please |
|
Should really be fixed now... |
|
Test build #114668 has finished for PR 26697 at commit
|
|
retest this please |
|
Test build #114680 has finished for PR 26697 at commit
|
|
Merged to master. |
…le of the column ## What changes were proposed in this pull request? [HIVE-12063](https://issues.apache.org/jira/browse/HIVE-12063) improved pad decimal numbers with trailing zeros to the scale of the column. The following description is copied from the description of HIVE-12063. > HIVE-7373 was to address the problems of trimming tailing zeros by Hive, which caused many problems including treating 0.0, 0.00 and so on as 0, which has different precision/scale. Please refer to HIVE-7373 description. However, HIVE-7373 was reverted by HIVE-8745 while the underlying problems remained. HIVE-11835 was resolved recently to address one of the problems, where 0.0, 0.00, and so on cannot be read into decimal(1,1). However, HIVE-11835 didn't address the problem of showing as 0 in query result for any decimal values such as 0.0, 0.00, etc. This causes confusion as 0 and 0.0 have different precision/scale than 0. The proposal here is to pad zeros for query result to the type's scale. This not only removes the confusion described above, but also aligns with many other DBs. Internal decimal number representation doesn't change, however. **Spark SQL**: ```sql // bin/spark-sql spark-sql> select cast(1 as decimal(38, 18)); 1 spark-sql> // bin/beeline 0: jdbc:hive2://localhost:10000/default> select cast(1 as decimal(38, 18)); +----------------------------+--+ | CAST(1 AS DECIMAL(38,18)) | +----------------------------+--+ | 1.000000000000000000 | +----------------------------+--+ // bin/spark-shell scala> spark.sql("select cast(1 as decimal(38, 18))").show(false) +-------------------------+ |CAST(1 AS DECIMAL(38,18))| +-------------------------+ |1.000000000000000000 | +-------------------------+ // bin/pyspark >>> spark.sql("select cast(1 as decimal(38, 18))").show() +-------------------------+ |CAST(1 AS DECIMAL(38,18))| +-------------------------+ | 1.000000000000000000| +-------------------------+ // bin/sparkR > showDF(sql("SELECT cast(1 as decimal(38, 18))")) +-------------------------+ |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) ``` ## How was this patch tested? unit tests and manual test: ```sql spark-sql> select cast(1 as decimal(38, 18)); 1.000000000000000000 ``` Spark SQL Upgrading Guide:  Closes apache#26697 from wangyum/SPARK-28461. Authored-by: Yuming Wang <[email protected]> Signed-off-by: HyukjinKwon <[email protected]>
…zeros (apache#243) * [HADP-45102] Add config not to pad decimal with trailing zeros for compatibility with 2.3.1 (apache#101) ### What changes were proposed in this pull request? Add config `spark.sql.legacy.decimal.padTrailingZeros` such that padding decimal with trailing zeros can be disabled for spark-sql interface ### Why are the changes needed? In 2.3.1 decimals are not padded with trailing zeros which is changed in apache#26697. This is to keep compatibility with 2.3.1. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existing UT updated. Co-authored-by: tianlzhang <[email protected]>
What changes were proposed in this pull request?
HIVE-12063 improved pad decimal numbers with trailing zeros to the scale of the column. The following description is copied from the description of HIVE-12063.
Spark SQL:
PostgreSQL:
Presto:
How was this patch tested?
unit tests and manual test:
Spark SQL Upgrading Guide:
