Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-6878

Sum on empty RDD fails with exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.2.0
    • 1.2.2, 1.3.2, 1.4.0
    • Spark Core
    • None
    • Patch

    Description

      Sum on an empty RDD throws an exception. Expected result is 0.

      A simple fix is the replace

      class DoubleRDDFunctions {
        def sum(): Double = self.reduce(_ + _)
      

      with:

      class DoubleRDDFunctions {
        def sum(): Double = self.aggregate(0.0)(_ + _, _ + _)
      

      Attachments

        Issue Links

          Activity

            People

              erikvanoosten Erik van Oosten
              erikvanoosten Erik van Oosten
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: