RDD.
coalesce
Return a new RDD that is reduced into numPartitions partitions.
New in version 1.0.0.
the number of partitions in new RDD
RDD
whether to add a shuffle step
a RDD that is reduced into numPartitions partitions
See also
RDD.repartition()
Examples
>>> sc.parallelize([1, 2, 3, 4, 5], 3).glom().collect() [[1], [2, 3], [4, 5]] >>> sc.parallelize([1, 2, 3, 4, 5], 3).coalesce(1).glom().collect() [[1, 2, 3, 4, 5]]