'Spark / Scala - Is there a way to keep track of a map per partition?

Is there a way to hold a data structure per partition that you can access? For example, word count, keep track of a dictionary of counts per partition, that you incr / decr keys as you do a second read based on the state of other keys in the dictionary?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source