Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Table not found: patient_info;

Highlighted

Table not found: patient_info;

Hi, I have created a temp table in spark using following code & trying to fetch data "%sql select * from patient_info" ; however getting error Table not found: patient_info;

val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc)

val df = sqlContext.sql("SELECT * FROM emr.patient_information_raw")

df.count()

val dropDuplicates = df.dropDuplicates(Array("person_name","last_name","gender","person_date_of_birth"))

val filledEthnicity = dropDuplicates.na.fill("Colombian1", Array("ethnicity"))

filledEthnicity.count()

val filledStreet = filledEthnicity.na.fill("Street", Array("street"))

val filledState = filledStreet.na.fill("Nevada", Array("state"))

val fillGender = filledState.na.fill("Female", Array("gender"))

fillGender.count()

fillGender.toDF().registerTempTable("patient_info")

%sql select * from patient_info

Table not found: patient_info;

set zeppelin.spark.sql.stacktrace = true to see full stacktrace

3 REPLIES 3
Highlighted

Re: Table not found: patient_info;

seems spark session is not visible to %sql session, can you try to create table from %livy.spark and access it using %livy.sql then you will be able to see table as both share same session.

Re: Table not found: patient_info;

%livy.spark select * from patient_info

<console>:33: error: not found: value select select * from patient_info

I tried in hive session

%hive select * from patient_info

getting bellow error

Error while compiling statement: FAILED: SemanticException [Error 10001]: Line 1:14 Table not found 'patient_info'

Can anyone please help me.

Highlighted

Re: Table not found: patient_info;

@Prasanta Sahoo Please comment this line : "val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc)" and try. I think the issue is because you are creating sqlContext yourselt.

Don't have an account?
Coming from Hortonworks? Activate your account here