aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
Diffstat (limited to 'sql/hive')
-rw-r--r--sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala18
1 files changed, 15 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 863a5db1bf..a8e8e70db0 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
@@ -25,6 +25,7 @@ import org.apache.hadoop.hive.ql.parse.VariableSubstitution
import org.apache.spark.sql.catalyst.ParserDialect
import scala.collection.JavaConversions._
+import scala.collection.mutable.HashMap
import scala.language.implicitConversions
import org.apache.hadoop.fs.{FileSystem, Path}
@@ -153,7 +154,7 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
* Hive 13 as this is the version of Hive that is packaged with Spark SQL. This copy of the
* client is used for execution related tasks like registering temporary functions or ensuring
* that the ThreadLocal SessionState is correctly populated. This copy of Hive is *not* used
- * for storing peristent metadata, and only point to a dummy metastore in a temporary directory.
+ * for storing persistent metadata, and only point to a dummy metastore in a temporary directory.
*/
@transient
protected[hive] lazy val executionHive: ClientWrapper = {
@@ -507,8 +508,19 @@ private[hive] object HiveContext {
def newTemporaryConfiguration(): Map[String, String] = {
val tempDir = Utils.createTempDir()
val localMetastore = new File(tempDir, "metastore").getAbsolutePath
- Map(
- "javax.jdo.option.ConnectionURL" -> s"jdbc:derby:;databaseName=$localMetastore;create=true")
+ val propMap: HashMap[String, String] = HashMap()
+ // We have to mask all properties in hive-site.xml that relates to metastore data source
+ // as we used a local metastore here.
+ HiveConf.ConfVars.values().foreach { confvar =>
+ if (confvar.varname.contains("datanucleus") || confvar.varname.contains("jdo")) {
+ propMap.put(confvar.varname, confvar.defaultVal)
+ }
+ }
+ propMap.put("javax.jdo.option.ConnectionURL",
+ s"jdbc:derby:;databaseName=$localMetastore;create=true")
+ propMap.put("datanucleus.rdbms.datastoreAdapterClassName",
+ "org.datanucleus.store.rdbms.adapter.DerbyAdapter")
+ propMap.toMap
}
protected val primitiveTypes =