H13-723_V2.0 · Question #34
In Spark, the accumulator can realize high-speed parallel counter and variable summation; in the process of Spark application development, only the value of this counter can be obtained on the Driver.
The correct answer is A. True. Option A is correct because Spark accumulators are designed specifically as write-only variables for executors and read-only on the Driver - only the Driver can call .value to read the accumulated result. Executors can add to an accumulator during task execution, but they…
Question
In Spark, the accumulator can realize high-speed parallel counter and variable summation; in the process of Spark application development, only the value of this counter can be obtained on the Driver.
Options
- ATrue
- BFalse
How the community answered
(47 responses)- A72% (34)
- B28% (13)
Explanation
Option A is correct because Spark accumulators are designed specifically as write-only variables for executors and read-only on the Driver - only the Driver can call .value to read the accumulated result. Executors can add to an accumulator during task execution, but they cannot read its current value; this one-directional design ensures consistent aggregation across parallel tasks without coordination overhead. This makes accumulators ideal for distributed counters and sums (e.g., counting malformed records) where you only need the final total after all tasks complete.
Why B is wrong: There is no exception to this rule - it is a fundamental design constraint of the accumulator API, not an optional behavior.
Memory tip: Think of an accumulator like a suggestion box - workers (executors) can only drop items in, while only the manager (Driver) can open the box and count what's inside.
Topics
Community Discussion
No community discussion yet for this question.