我想写一个数据帧到HDF。但随机排序非常慢,尽管只有1700万个数据行。
df = df.withColumn('random_index',rand()) df = df.orderBy('random_index') df.write.csv('hdfs:///user/yananc/yanan_gbdt_dnn', sep=',')
有没有快速有效的方法来实现这一点?
orderBy sortWithinPartitions
orderBy
sortWithinPartitions
df.sortWithinPartitions(rand())