You can create an in-memory temporary table and store them in hive table using sqlContext.
Lets say your data frame is myDf. You can create one temporary table using,
myDf.createOrReplaceTempView("mytempTable")
Then you can use a simple hive statement to create table and dump the data from your temp table.
sqlContext.sql("create table mytable as select * from mytempTable");
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…