[jira] [Commented] (SPARK-6878) Sum on empty RDD fails with exception
[ https://issues.apache.org/jira/browse/SPARK-6878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14492302#comment-14492302 ] Erik van Oosten commented on SPARK-6878: Ah, yes. I now see that fold also first reduces per partition. Sum on empty RDD fails with exception - Key: SPARK-6878 URL: https://issues.apache.org/jira/browse/SPARK-6878 Project: Spark Issue Type: Bug Components: Spark Core Affects Versions: 1.2.0 Reporter: Erik van Oosten Priority: Minor {{Sum}} on an empty RDD throws an exception. Expected result is {{0}}. A simple fix is the replace {noformat} class DoubleRDDFunctions { def sum(): Double = self.reduce(_ + _) {noformat} with: {noformat} class DoubleRDDFunctions { def sum(): Double = self.aggregate(0.0)(_ + _, _ + _) {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-6878) Sum on empty RDD fails with exception
[ https://issues.apache.org/jira/browse/SPARK-6878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14492284#comment-14492284 ] Sean Owen commented on SPARK-6878: -- Yes, and I think it could even be a little simpler by calling {{fold(0.0)(_ + _)}} ? Sum on empty RDD fails with exception - Key: SPARK-6878 URL: https://issues.apache.org/jira/browse/SPARK-6878 Project: Spark Issue Type: Bug Components: Spark Core Affects Versions: 1.2.0 Reporter: Erik van Oosten Priority: Minor {{Sum}} on an empty RDD throws an exception. Expected result is {{0}}. A simple fix is the replace {noformat} class DoubleRDDFunctions { def sum(): Double = self.reduce(_ + _) {noformat} with: {noformat} class DoubleRDDFunctions { def sum(): Double = self.aggregate(0.0)(_ + _, _ + _) {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-6878) Sum on empty RDD fails with exception
[ https://issues.apache.org/jira/browse/SPARK-6878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14492336#comment-14492336 ] Erik van Oosten commented on SPARK-6878: Pull request: https://github.com/apache/spark/pull/5489 Sum on empty RDD fails with exception - Key: SPARK-6878 URL: https://issues.apache.org/jira/browse/SPARK-6878 Project: Spark Issue Type: Bug Components: Spark Core Affects Versions: 1.2.0 Reporter: Erik van Oosten Priority: Minor {{Sum}} on an empty RDD throws an exception. Expected result is {{0}}. A simple fix is the replace {noformat} class DoubleRDDFunctions { def sum(): Double = self.reduce(_ + _) {noformat} with: {noformat} class DoubleRDDFunctions { def sum(): Double = self.aggregate(0.0)(_ + _, _ + _) {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-6878) Sum on empty RDD fails with exception
[ https://issues.apache.org/jira/browse/SPARK-6878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14492271#comment-14492271 ] Sean Owen commented on SPARK-6878: -- Interesting question -- what's the expected sum of nothing at all? although I can see the argument both ways, 0 is probably the better result since {{Array[Double]().sum}} is 0. So {{sc.parallelize(Array[Double]()).sum}} should as well. Want to make a PR? Sum on empty RDD fails with exception - Key: SPARK-6878 URL: https://issues.apache.org/jira/browse/SPARK-6878 Project: Spark Issue Type: Bug Components: Spark Core Affects Versions: 1.2.0 Reporter: Erik van Oosten Priority: Minor {{Sum}} on an empty RDD throws an exception. Expected result is {{0}}. A simple fix is the replace {noformat} class DoubleRDDFunctions { def sum(): Double = self.reduce(_ + _) {noformat} with: {noformat} class DoubleRDDFunctions { def sum(): Double = self.aggregate(0.0)(_ + _, _ + _) {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-6878) Sum on empty RDD fails with exception
[ https://issues.apache.org/jira/browse/SPARK-6878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14492282#comment-14492282 ] Erik van Oosten commented on SPARK-6878: The answer is only defined because the RDD is an {{RDD[Double]}} :) Sure, I'll make a PR. Sum on empty RDD fails with exception - Key: SPARK-6878 URL: https://issues.apache.org/jira/browse/SPARK-6878 Project: Spark Issue Type: Bug Components: Spark Core Affects Versions: 1.2.0 Reporter: Erik van Oosten Priority: Minor {{Sum}} on an empty RDD throws an exception. Expected result is {{0}}. A simple fix is the replace {noformat} class DoubleRDDFunctions { def sum(): Double = self.reduce(_ + _) {noformat} with: {noformat} class DoubleRDDFunctions { def sum(): Double = self.aggregate(0.0)(_ + _, _ + _) {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-6878) Sum on empty RDD fails with exception
[ https://issues.apache.org/jira/browse/SPARK-6878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14492335#comment-14492335 ] Apache Spark commented on SPARK-6878: - User 'erikvanoosten' has created a pull request for this issue: https://github.com/apache/spark/pull/5489 Sum on empty RDD fails with exception - Key: SPARK-6878 URL: https://issues.apache.org/jira/browse/SPARK-6878 Project: Spark Issue Type: Bug Components: Spark Core Affects Versions: 1.2.0 Reporter: Erik van Oosten Priority: Minor {{Sum}} on an empty RDD throws an exception. Expected result is {{0}}. A simple fix is the replace {noformat} class DoubleRDDFunctions { def sum(): Double = self.reduce(_ + _) {noformat} with: {noformat} class DoubleRDDFunctions { def sum(): Double = self.aggregate(0.0)(_ + _, _ + _) {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org