How to save DataFrame directly to Hive?

The Solution to How to save DataFrame directly to Hive? is


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

~ Answered on 2016-02-18 10:12:18


Most Viewed Questions: