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

AccumulatorV2 isZero doesn't do what its name implies

    XMLWordPrintableJSON

Details

    Description

      `AccumulatorV2`'s `isZero` doesn't do what the name or comment implies - it actually checks if the accumulator hasn't been updated.

      The comment implies that for a `LongAccumulator`, for example, a value of `0` would cause `isZero` to be `true`. But if we were to `add(0)`, then the value would still be `0` but `isZero` would return `false`.

      Propose to rename this to `isUpdated` so the name matches the meaning more closely.

      Attachments

        Issue Links

          Activity

            People

              dtjong Davin Tjong
              dtjong Davin Tjong
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: