Get current number of partitions of a DataFrame

后端 未结 5 1097
太阳男子
太阳男子 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 19:02

     val df = Seq(
      ("A", 1), ("B", 2), ("A", 3), ("C", 1)
    ).toDF("k", "v")
    
    df.rdd.getNumPartitions
    

提交回复
热议问题