Get current number of partitions of a DataFrame

后端 未结 5 1095
太阳男子
太阳男子 2020-12-07 18:32

Is there any way to get the current number of partitions of a DataFrame? I checked the DataFrame javadoc (spark 1.6) and didn\'t found a method for that, or am I just missed

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 18:59

    You need to call getNumPartitions() on the DataFrame's underlying RDD, e.g., df.rdd.getNumPartitions(). In the case of Scala, this is a parameterless method: df.rdd.getNumPartitions.

提交回复
热议问题