Enum in key for Pair Rdd
Be careful using java enums in key for PairRDD
Example: java enum:
and simple spark job that calculate amount of ODD and EVEN numbers between 1 to 10000
The output of that spark job is
The problem is based on the fact that reduce by key is using equals and hashCode methods of key. However, as spark job is executed in different JVMs, hashcodes of the same enum value are different.