val rdd=sc.parallelize(List(("Jack","America","23"),("Mark","China","25"),("Lura","Australia","24")))

import sqlContext.implicits._
val df=rdd.repartition(1).toDF("name","country","age")//写文件的个数为repartition数

df.write.option("header",true).option("encoding", "UTF-8").csv("C:\\Users\\peanut\\Desktop\\myStudent")

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2022-01-04
  • 2021-10-07
  • 2021-10-03
相关资源
相似解决方案