Spark中有没有一种方法(方法)可以找出分区ID/编号
在这里举这个例子
val input1 = sc.parallelize(List(8, 9, 10), 3)
val res = input1.reduce{ (x, y) => println("Inside partiton " + ???)
x + y)}
我想放入一些代码???
打印分区 ID/编号
您还可以使用
TaskContext.getPartitionId()
例如,代替目前缺少的 foreachPartitionWithIndex()
https://github.com/apache/spark/pull/5927#issuecomment-99697229 https://github.com/apache/spark/pull/5927#issuecomment-99697229
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)