Facing issue with registerTempTable in Spark SQL

Facing issue with registerTempTable in Spark SQL
5.0 1


Hi All,

I am facing while creating temp table using registerTempTable

Spark Version - 1.6.0
Scala Version - 2.10.5

Note : I have imported all necessary items
import org.apache.spark.sql.SQLContext
val sqlContext = new org.apache.spark.sql.SQLContext(sc)
val sqlContext = new org.apache.spark.sql.SQLContext(sc)

Problem : When I am trying to run any sql query against the registerTempTable name then I am getting an error stating like “Table Not found Error” …Kindly help me in this …I am stuck on this thing from past 1 month and not able to get any reliable information on the net too.

Below is the code

val data = sc.textFile("/home/kiran/Downloads/911.csv")

val header = data.first()

val data1 = data.filter(row => row != header)

case class emergency(lat:String,lng:String,desc:String,zip:String,title:String,timeStamp:String,twp:String,addr:String,e:String)

val emergency_data = data1.map(x=>x.split(",")).filter(x => x.length>=9).map(x => emergency(x(0),x(1),x(2),x(3),x(4).substring(0 , x(4).indexOf(":")




What is the query you are trying to run?


Thanks for checking on this…I have corrected the issue. What I am doing wrong is not importing the required packages before creating Dataframe and that the reason I am unable to create temp table

Note : Before working with data frame you have to import all the necessary package and if you import those things in mide it won’t help you in anyways

Thanks once again for getting back on this.


What packages did you need to import?