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")

  

你可能感兴趣的:(spark)