load文件到hive,并保存

DataFrame usersDF = sqlContext.read().load("hdfs://spark1:9000/users.parquet");

usersDF.select("name", "favorite_color").write()
.save("hdfs://spark1:9000/namesAndFavColors.parquet");


//load、save方法~指定文件格式
DataFrame peopleDF = sqlContext.read().format("json")
.load("hdfs://spark1:9000/people.json");
peopleDF.select("name").write().format("parquet")

.save("hdfs://spark1:9000/peopleName_java");

posted @ 2019-07-31 13:15  一颗小白菜灬  阅读(754)  评论(0编辑  收藏  举报