sc = SparkContext("Local")
rdd = sc.binaryFiles(Path to the binary file , minPartitions = 5).partitionBy(8)
Run Code Online (Sandbox Code Playgroud)
要么
sc = SparkContext("Local")
rdd = sc.binaryFiles(Path to the binary file , minPartitions = 5).repartition(8)
Run Code Online (Sandbox Code Playgroud)
使用上述任一代码,我试图在我的RDD中创建8个分区{其中,我希望数据在所有分区上均匀分布}.当我打印{rdd.getNumPartitions()}所示的分区的数目是8只,但在火花UI,我观察到,虽然8个分区由但所有的整个二进制文件数据被放置在仅一个分区.
注意:minPartition属性不起作用.即使在设置minPartitions = 5之后,RDD中创建的分区数也只有1.因此,使用了partitionBy/repartition函数.
这是期望的行为还是我错过了什么?