Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is getNumPartitions an RDD action or transformation?

Is RDD's getNumPartitions a transformation or an action?

like image 884
Satya Avatar asked Oct 29 '25 11:10

Satya


1 Answers

Is it an action?

NO, If you do getNumPartition() on any RDD, It just fetches the meta(partitions.length) of an RDD and no tasks will be submitted.

Is it a transformation?

My understanding about transformation is "It should return an RDD when that function applied on RDD". But getNumPartition() return integer.


Check the definition of function in RDD.scala

  @Since("1.6.0")
  final def getNumPartitions: Int = partitions.length
like image 53
mrsrinivas Avatar answered Oct 31 '25 12:10

mrsrinivas