获取数据框的当前分区数 [英] Get current number of partitions of a DataFrame

查看:38
本文介绍了获取数据框的当前分区数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以获取DataFrame的当前分区数吗? 我检查了DataFrame javadoc(spark 1.6),但没有找到用于该方法的方法,还是只是错过了它? (对于JavaRDD,有一个getNumPartitions()方法.)

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 it? (In case of JavaRDD there's a getNumPartitions() method.)

推荐答案

您需要在DataFrame的基础RDD上调用getNumPartitions(),例如df.rdd.getNumPartitions().对于Scala,这是一种无参数方法:df.rdd.getNumPartitions.

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.

这篇关于获取数据框的当前分区数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆