Is it possible to save DataFrame
in spark directly to Hive?
I have tried with converting DataFrame
to Rdd
and then saving as a text file and then loading in hive. But I am wondering if I can directly save dataframe
to hive
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");