The reason I am afraid about introducing a getPartitioner() is that it changes the public API of RDD, which does not seem to be worth it to solve this problem.