-
Notifications
You must be signed in to change notification settings - Fork 29k
[SQL] Using safe floating-point numbers in doctest #1925
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
|
QA tests have started for PR 1925. This patch merges cleanly. |
|
After some thoughts, I think we still need to use safer floating-point numbers ( |
|
QA tests have started for PR 1925. This patch merges cleanly. |
|
QA results for PR 1925: |
|
QA results for PR 1925: |
python/pyspark/sql.py
Outdated
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 ... is not needed any more
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.
Removed ..., thanks :)
|
This issue is introduced by convert Float to Double in JVM: scala> (1.0f + 1.1).toFloat.toDouble scala> (1.0f + 1.1f).toDouble scala> 1.0 + 1.1f |
|
@davies so does this solution seem reasonable? |
|
Yes, look good to me. |
|
scala> 1.5f.toDouble scala> 2.5f.toDouble |
|
Thanks, I've merged this into master and 1.1 |
Test code in `sql.py` tries to compare two floating-point numbers directly, and cased [build failure(s)](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/18365/consoleFull). [Doctest documentation](https://docs.python.org/3/library/doctest.html#warnings) recommends using numbers in the form of `I/2**J` to avoid the precision issue. Author: Cheng Lian <[email protected]> Closes #1925 from liancheng/fix-pysql-fp-test and squashes the following commits: 0fbf584 [Cheng Lian] Removed unnecessary `...' from inferSchema doctest e8059d4 [Cheng Lian] Using safe floating-point numbers in doctest (cherry picked from commit b4a0592) Signed-off-by: Michael Armbrust <[email protected]>
Test code in `sql.py` tries to compare two floating-point numbers directly, and cased [build failure(s)](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/18365/consoleFull). [Doctest documentation](https://docs.python.org/3/library/doctest.html#warnings) recommends using numbers in the form of `I/2**J` to avoid the precision issue. Author: Cheng Lian <[email protected]> Closes apache#1925 from liancheng/fix-pysql-fp-test and squashes the following commits: 0fbf584 [Cheng Lian] Removed unnecessary `...' from inferSchema doctest e8059d4 [Cheng Lian] Using safe floating-point numbers in doctest
Test code in
sql.pytries to compare two floating-point numbers directly, and cased build failure(s).Doctest documentation recommends using numbers in the form of
I/2**Jto avoid the precision issue.