RE: SparkSQL can not use SchemaRDD from Hive

2014-07-29 Thread Cheng, Hao
In your code snippet, sample is actually a SchemaRDD, and SchemaRDD actually 
binds a certain SQLContext in runtime, I don't think we can manipulate/share 
the SchemaRDD across SQLContext Instances.

-Original Message-
From: Kevin Jung [mailto:itsjb.j...@samsung.com] 
Sent: Tuesday, July 29, 2014 1:47 PM
To: u...@spark.incubator.apache.org
Subject: SparkSQL can not use SchemaRDD from Hive

Hi
I got a error message while using Hive and SparkSQL.
This is code snippet I used.

(in spark-shell , 1.0.0)
val sqlContext = new org.apache.spark.sql.SQLContext(sc)
import sqlContext._
val hive = new org.apache.spark.sql.hive.HiveContext(sc)
var sample = hive.hql(select * from sample10) // This creates SchemaRDD. I 
have table 'sample10' in hive.
var countHive = sample.count() // It works
sqlContext.registerRDDAsTable(sample,temp)
sqlContext.sql(select * from temp).count() // It gives me a error message
java.lang.RuntimeException: Table Not Found: sample10

I don't know why this happen. Does SparkSQL conflict with Hive?

Thanks,
Kevin



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/SparkSQL-can-not-use-SchemaRDD-from-Hive-tp10841.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.


Re: SparkSQL can not use SchemaRDD from Hive

2014-07-29 Thread Zongheng Yang
As Hao already mentioned, using 'hive' (the HiveContext) throughout would
work.

On Monday, July 28, 2014, Cheng, Hao hao.ch...@intel.com wrote:

 In your code snippet, sample is actually a SchemaRDD, and SchemaRDD
 actually binds a certain SQLContext in runtime, I don't think we can
 manipulate/share the SchemaRDD across SQLContext Instances.

 -Original Message-
 From: Kevin Jung [mailto:itsjb.j...@samsung.com javascript:;]
 Sent: Tuesday, July 29, 2014 1:47 PM
 To: u...@spark.incubator.apache.org javascript:;
 Subject: SparkSQL can not use SchemaRDD from Hive

 Hi
 I got a error message while using Hive and SparkSQL.
 This is code snippet I used.

 (in spark-shell , 1.0.0)
 val sqlContext = new org.apache.spark.sql.SQLContext(sc)
 import sqlContext._
 val hive = new org.apache.spark.sql.hive.HiveContext(sc)
 var sample = hive.hql(select * from sample10) // This creates SchemaRDD.
 I have table 'sample10' in hive.
 var countHive = sample.count() // It works
 sqlContext.registerRDDAsTable(sample,temp)
 sqlContext.sql(select * from temp).count() // It gives me a error message
 java.lang.RuntimeException: Table Not Found: sample10

 I don't know why this happen. Does SparkSQL conflict with Hive?

 Thanks,
 Kevin



 --
 View this message in context:
 http://apache-spark-user-list.1001560.n3.nabble.com/SparkSQL-can-not-use-SchemaRDD-from-Hive-tp10841.html
 Sent from the Apache Spark User List mailing list archive at Nabble.com.



SparkSQL can not use SchemaRDD from Hive

2014-07-28 Thread Kevin Jung
Hi
I got a error message while using Hive and SparkSQL.
This is code snippet I used.

(in spark-shell , 1.0.0)
val sqlContext = new org.apache.spark.sql.SQLContext(sc)
import sqlContext._
val hive = new org.apache.spark.sql.hive.HiveContext(sc)
var sample = hive.hql(select * from sample10) // This creates SchemaRDD. I
have table 'sample10' in hive.
var countHive = sample.count() // It works
sqlContext.registerRDDAsTable(sample,temp)
sqlContext.sql(select * from temp).count() // It gives me a error message
java.lang.RuntimeException: Table Not Found: sample10

I don't know why this happen. Does SparkSQL conflict with Hive?

Thanks,
Kevin



--
View this message in context: 
http://apache-spark-user-list.1001560.n3.nabble.com/SparkSQL-can-not-use-SchemaRDD-from-Hive-tp10841.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.