aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorYin Huai <yhuai@databricks.com>2015-10-12 13:50:34 -0700
committerDavies Liu <davies.liu@gmail.com>2015-10-12 13:50:34 -0700
commit8a354bef55ce9cc0fa77fa1c3a9d62c16438ca1b (patch)
treebf1562dc95f86bfcd80ec20f0121bb5812d33bdc /sql/hive
parent2e572c4135c3f5ad3061c1f58cdb8a70bed0a9d3 (diff)
downloadspark-8a354bef55ce9cc0fa77fa1c3a9d62c16438ca1b.tar.gz
spark-8a354bef55ce9cc0fa77fa1c3a9d62c16438ca1b.tar.bz2
spark-8a354bef55ce9cc0fa77fa1c3a9d62c16438ca1b.zip
[SPARK-11042] [SQL] Add a mechanism to ban creating multiple root SQLContexts/HiveContexts in a JVM
https://issues.apache.org/jira/browse/SPARK-11042 Author: Yin Huai <yhuai@databricks.com> Closes #9058 from yhuai/SPARK-11042.
Diffstat (limited to 'sql/hive')
-rw-r--r--sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala12
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala
index dad1e2347c..ddeadd3eb7 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala
@@ -89,10 +89,11 @@ class HiveContext private[hive](
sc: SparkContext,
cacheManager: CacheManager,
@transient execHive: ClientWrapper,
- @transient metaHive: ClientInterface) extends SQLContext(sc, cacheManager) with Logging {
+ @transient metaHive: ClientInterface,
+ isRootContext: Boolean) extends SQLContext(sc, cacheManager, isRootContext) with Logging {
self =>
- def this(sc: SparkContext) = this(sc, new CacheManager, null, null)
+ def this(sc: SparkContext) = this(sc, new CacheManager, null, null, true)
def this(sc: JavaSparkContext) = this(sc.sc)
import org.apache.spark.sql.hive.HiveContext._
@@ -105,7 +106,12 @@ class HiveContext private[hive](
* and Hive client (both of execution and metadata) with existing HiveContext.
*/
override def newSession(): HiveContext = {
- new HiveContext(sc, cacheManager, executionHive.newSession(), metadataHive.newSession())
+ new HiveContext(
+ sc = sc,
+ cacheManager = cacheManager,
+ execHive = executionHive.newSession(),
+ metaHive = metadataHive.newSession(),
+ isRootContext = false)
}
/**