carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [1/2] incubator-carbondata git commit: get HIVE_CONNECTION_URL from hadoopConfiguration
Date Wed, 26 Apr 2017 05:54:27 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master d695a8af4 -> 373f4e795


get HIVE_CONNECTION_URL from hadoopConfiguration


Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/075e74e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/075e74e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/075e74e7

Branch: refs/heads/master
Commit: 075e74e7425e39c93d8a0761be6cc28faf072019
Parents: d695a8a
Author: QiangCai <qiangcai@qq.com>
Authored: Mon Apr 24 21:10:08 2017 +0800
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Wed Apr 26 11:23:15 2017 +0530

----------------------------------------------------------------------
 .../scala/org/apache/spark/sql/CarbonSession.scala   | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/075e74e7/integration/spark2/src/main/scala/org/apache/spark/sql/CarbonSession.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/CarbonSession.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/CarbonSession.scala
index 1ce170c..844b3b9 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/CarbonSession.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/CarbonSession.scala
@@ -81,13 +81,6 @@ object CarbonSession {
         getValue("options", builder).asInstanceOf[scala.collection.mutable.HashMap[String,
String]]
       val userSuppliedContext: Option[SparkContext] =
         getValue("userSuppliedContext", builder).asInstanceOf[Option[SparkContext]]
-      if (options.get(CarbonCommonConstants.HIVE_CONNECTION_URL).isEmpty &&
-          new Configuration().get(CarbonCommonConstants.HIVE_CONNECTION_URL) == null) {
-        val metaStorePathAbsolute = new File(metaStorePath).getCanonicalPath
-        val hiveMetaStoreDB = metaStorePathAbsolute + "/metastore_db"
-        options ++= Map[String, String]((CarbonCommonConstants.HIVE_CONNECTION_URL,
-          s"jdbc:derby:;databaseName=$hiveMetaStoreDB;create=true"))
-      }
       // Get the session from current thread's active session.
       var session: SparkSession = SparkSession.getActiveSession match {
         case Some(sparkSession: CarbonSession) =>
@@ -142,6 +135,14 @@ object CarbonSession {
         CarbonProperties.getInstance()
           .addProperty(CarbonCommonConstants.STORE_LOCATION, storePath)
         session = new CarbonSession(sparkContext)
+        val hadoopConf = session.sharedState.sparkContext.hadoopConfiguration
+        if (options.get(CarbonCommonConstants.HIVE_CONNECTION_URL).isEmpty &&
+            hadoopConf.get(CarbonCommonConstants.HIVE_CONNECTION_URL) == null) {
+          val metaStorePathAbsolute = new File(metaStorePath).getCanonicalPath
+          val hiveMetaStoreDB = metaStorePathAbsolute + "/metastore_db"
+          options ++= Map[String, String]((CarbonCommonConstants.HIVE_CONNECTION_URL,
+            s"jdbc:derby:;databaseName=$hiveMetaStoreDB;create=true"))
+        }
         options.foreach { case (k, v) => session.sessionState.conf.setConfString(k, v)
}
         SparkSession.setDefaultSession(session)
 


Mime
View raw message