-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
SPARK-6878 [CORE] Fix for sum on empty RDD fails with exception #5489
Conversation
(Could you start the title with |
|
||
import org.apache.spark._ | ||
|
||
class DoubleRDDSuite extends FunSuite with SharedSparkContext { | ||
test("sum") { | ||
sc.parallelize(Seq.empty[Double]).sum() should be(0.0 +- 0.0001) |
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.
I would just use assert
here as int he rest of the file. Also I think you can assert exact equality in these cases. It really should be 3.0
in the last instance, precisely.
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.
Experience thought me that exact equality with doubles is unreliable. Now I err on the safe side and always use inexact matchers in unit tests.
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.
Doubles aren't unstable; 0.0 == 0.0
always. Yes i know what you mean but in these cases we can expect the result to exact to machine precision, always.
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.
I didn't say unstable :)
Anyway, changed as requested.
ok to test |
LGTM pending tests, thank you. |
Test build #30158 has finished for PR 5489 at commit
|
Test build #30162 has finished for PR 5489 at commit
|
Author: Erik van Oosten <evanoosten@ebay.com> Closes #5489 from erikvanoosten/master and squashes the following commits: 1c91954 [Erik van Oosten] Rewrote double range matcher to an exact equality assert (SPARK-6878) f1708c9 [Erik van Oosten] Fix for sum on empty RDD fails with exception (SPARK-6878) (cherry picked from commit 51b306b) Signed-off-by: Sean Owen <sowen@cloudera.com>
Author: Erik van Oosten <evanoosten@ebay.com> Closes #5489 from erikvanoosten/master and squashes the following commits: 1c91954 [Erik van Oosten] Rewrote double range matcher to an exact equality assert (SPARK-6878) f1708c9 [Erik van Oosten] Fix for sum on empty RDD fails with exception (SPARK-6878) (cherry picked from commit 51b306b) Signed-off-by: Sean Owen <sowen@cloudera.com>
Author: Erik van Oosten <evanoosten@ebay.com> Closes apache#5489 from erikvanoosten/master and squashes the following commits: 1c91954 [Erik van Oosten] Rewrote double range matcher to an exact equality assert (SPARK-6878) f1708c9 [Erik van Oosten] Fix for sum on empty RDD fails with exception (SPARK-6878) (cherry picked from commit 51b306b) Signed-off-by: Sean Owen <sowen@cloudera.com>
No description provided.