spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reynold Xin (JIRA)" <>
Subject [jira] [Updated] (SPARK-12469) Data Property Accumulators for Spark (formerly Consistent Accumulators)
Date Tue, 01 Nov 2016 00:54:58 GMT


Reynold Xin updated SPARK-12469:
    Target Version/s:   (was: 2.1.0)

> Data Property Accumulators for Spark (formerly Consistent Accumulators)
> -----------------------------------------------------------------------
>                 Key: SPARK-12469
>                 URL:
>             Project: Spark
>          Issue Type: Improvement
>          Components: Spark Core
>            Reporter: holdenk
> Tasks executed on Spark workers are unable to modify values from the driver, and accumulators
are the one exception for this. Accumulators in Spark are implemented in such a way that when
a stage is recomputed (say for cache eviction) the accumulator will be updated a second time.
This makes accumulators inside of transformations more difficult to use for things like counting
invalid records (one of the primary potential use cases of collecting side information during
a transformation). However in some cases this counting during re-evaluation is exactly the
behaviour we want (say in tracking total execution time for a particular function). Spark
would benefit from a version of accumulators which did not double count even if stages were
> Motivating example:
> {code}
> val parseTime = sc.accumulator(0L)
> val parseFailures = sc.accumulator(0L)
> val parsedData = sc.textFile(...).flatMap { line =>
>   val start = System.currentTimeMillis()
>   val parsed = Try(parse(line))
>   if (parsed.isFailure) parseFailures += 1
>   parseTime += System.currentTimeMillis() - start
>   parsed.toOption
> }
> parsedData.cache()
> val resultA =
> // some intervening code.  Almost anything could happen here -- some of parsedData may
> // get kicked out of the cache, or an executor where data was cached might get lost
> val resultB = parsedData.filter(...).map(...).flatMap(...).count()
> // now we look at the accumulators
> {code}
> Here we would want parseFailures to only have been added to once for every line which
failed to parse.  Unfortunately, the current Spark accumulator API doesn’t support the current
parseFailures use case since if some data had been evicted its possible that it will be double
> See the full design document at

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message