diff options
author | huangzhaowei <carlmartinmax@gmail.com> | 2015-10-17 16:41:49 -0700 |
---|---|---|
committer | Marcelo Vanzin <vanzin@cloudera.com> | 2015-10-17 16:41:52 -0700 |
commit | e2dfdbb2c0523517880138f214775f9a896f2271 (patch) | |
tree | 033fe5e5d8a3e9289480550ac93a7eaa2ee53f7b /yarn/src | |
parent | 022a8f6a1f7cb477a65a65482982c021ce08a73c (diff) | |
download | spark-e2dfdbb2c0523517880138f214775f9a896f2271.tar.gz spark-e2dfdbb2c0523517880138f214775f9a896f2271.tar.bz2 spark-e2dfdbb2c0523517880138f214775f9a896f2271.zip |
[SPARK-11000] [YARN] Load `metadata.Hive` class only when `hive.metastore.uris` was set to avoid bootting the database twice
Author: huangzhaowei <carlmartinmax@gmail.com>
Closes #9026 from SaintBacchus/SPARK-11000.
Diffstat (limited to 'yarn/src')
-rw-r--r-- | yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala b/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala index 9fcfe362a3..08aecfa7f6 100644 --- a/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala +++ b/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala @@ -1327,11 +1327,8 @@ object Client extends Logging { val mirror = universe.runtimeMirror(getClass.getClassLoader) try { - val hiveClass = mirror.classLoader.loadClass("org.apache.hadoop.hive.ql.metadata.Hive") - val hive = hiveClass.getMethod("get").invoke(null) - - val hiveConf = hiveClass.getMethod("getConf").invoke(hive) val hiveConfClass = mirror.classLoader.loadClass("org.apache.hadoop.hive.conf.HiveConf") + val hiveConf = hiveConfClass.newInstance() val hiveConfGet = (param: String) => Option(hiveConfClass .getMethod("get", classOf[java.lang.String]) @@ -1341,6 +1338,9 @@ object Client extends Logging { // Check for local metastore if (metastore_uri != None && metastore_uri.get.toString.size > 0) { + val hiveClass = mirror.classLoader.loadClass("org.apache.hadoop.hive.ql.metadata.Hive") + val hive = hiveClass.getMethod("get").invoke(null, hiveConf.asInstanceOf[Object]) + val metastore_kerberos_principal_conf_var = mirror.classLoader .loadClass("org.apache.hadoop.hive.conf.HiveConf$ConfVars") .getField("METASTORE_KERBEROS_PRINCIPAL").get("varname").toString |