spark sql中将数据保存成parquet,json格式

val df = sqlContext.load("/opt/modules/spark1.3.1/examples/src/main/resources/people.json","json")
df.select("name","age").save("/opt/test/namesAndAges.json","json")
//或者 df.select("name","age").save("/opt/test/namesAndAges.parquet","parquet")

  

posted @ 2015-05-18 14:09  HarkLee  阅读(1524)  评论(0编辑  收藏  举报