赞
踩
进入spark安装目录:/data0/spark/spark-2.2.1-bin/bin ,执行以下shell命令:
./spark-shell --master local[2] --jars /data0/spark/spark-2.2.1-bin/jars/mysql-connector-java-5.1.15-bin.jar
val df=spark.read.option("timestampFormat", "yyyy/MM/dd HH:mm:ss ZZ").json("file:///data0/project/person.json")
保存到person2.csv目录
- 保存到person2.csv目录
- pDF.select("name","age").write.format("csv").option("timestampFormat", "yyyy/MM/dd HH:mm:ss ZZ").save("file:///data0/project/person2.csv")
===============对比两种方式
参见:
spark-shell & spark-sql 使用blog.csdn.netCopyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。