Reputation: 691
How do you determine the number of partitions of an arbitrary RDD in Scala?
I know PySpark RDD has getNumPartitions defined in its API, but I can't locate the equivalent on the Scala side.
Upvotes: 4
Views: 4731
Reputation: 1291
At least in Spark 1.6.1 this works
rdd.getNumPartitions()
Upvotes: 5
Reputation: 9100
It should be rdd.partitions.length.
rdd.partitions.length