def myp(x):
return x % 100
pp = F.udf(myp)
df = spark.range(900)
df.show()
df = df.repartitionByRange(pp('id'))
df.write.format('csv').save('output')
把 id%100 相等的數據放到一個partition
def myp(x):
return x % 100
pp = F.udf(myp)
df = spark.range(900)
df.show()
df = df.repartitionByRange(pp('id'))
df.write.format('csv').save('output')
把 id%100 相等的數據放到一個partition
1. pyspark 版本 2.3.0版本 2. 官網 reduce(f)[source] Reduces the elements of this RDD using the specified
1. pyspark 版本 2.3.0版本 2. 解釋 union() 並集 intersection() 交集 subtr