You can use mapValues to ensure partitioning is not lost.
From: Brian London mailto:brianmlon...@gmail.com>>
Date: Monday, February 22, 2016 at 1:21 PM
To: user mailto:user@spark.apache.org>>
Subject: map operation clears custom partitioner
It appears that when a custom partitioner is applied in
The problem is that your new mapped values may be in the wrong
partition, according to your partitioner. Look for methods that have a
preservesPartitioning flag, which is a way to indicate that you know
the partitioning remains correct. (Like, you partition by keys and
didn't change the keys in map