Reading Data From Hive

Hello All,

How to read data from Hive Metastore using Data frame and Spark Sql ?

Regards ,
Amit

Check whether the sqlContext is of type HiveContext. If not import HiveContext and create HiveContext.
val hc = new HiveContext(sc)
hc.sql(“use databasename”)
val record = hc.sql(“your query”)
The record is of type DataFrame

Worked fine for me !! Thanks a lot