spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wenc...@apache.org
Subject spark git commit: [SPARK-17245][SQL][BRANCH-1.6] Do not rely on Hive's session state to retrieve HiveConf
Date Wed, 07 Sep 2016 13:55:14 GMT
Repository: spark
Updated Branches:
  refs/heads/branch-1.6 69fa9458e -> 047bc3f13


[SPARK-17245][SQL][BRANCH-1.6] Do not rely on Hive's session state to retrieve HiveConf

## What changes were proposed in this pull request?
Right now, we rely on Hive's `SessionState.get()` to retrieve the HiveConf used by ClientWrapper.
However, this conf is actually the HiveConf set with the `state`. There is a small chance
that we are trying to use the Hive client in a new thread while the global client has not
been created yet. In this case, `SessionState.get()` will return a `null`, which causes a
NPE when we call `SessionState.get(). getConf `. Since the conf that we want is actually the
conf we set to `state`. I am changing the code to just call `state.getConf` (this is also
what Spark 2.0 does).

## How was this patch tested?
I have not figured out a good way to reproduce this.

Author: Yin Huai <yhuai@databricks.com>

Closes #14816 from yhuai/SPARK-17245.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/047bc3f1
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/047bc3f1
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/047bc3f1

Branch: refs/heads/branch-1.6
Commit: 047bc3f13ae193aa49571b6e417f2b5001698bbd
Parents: 69fa945
Author: Yin Huai <yhuai@databricks.com>
Authored: Wed Sep 7 21:55:08 2016 +0800
Committer: Wenchen Fan <wenchen@databricks.com>
Committed: Wed Sep 7 21:55:08 2016 +0800

----------------------------------------------------------------------
 .../scala/org/apache/spark/sql/hive/client/ClientWrapper.scala     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/047bc3f1/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/ClientWrapper.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/ClientWrapper.scala
b/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/ClientWrapper.scala
index 075b4cb..f446f12 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/ClientWrapper.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/ClientWrapper.scala
@@ -213,7 +213,7 @@ private[hive] class ClientWrapper(
   }
 
   /** Returns the configuration for the current session. */
-  def conf: HiveConf = SessionState.get().getConf
+  def conf: HiveConf = state.getConf
 
   override def getConf(key: String, defaultValue: String): String = {
     conf.get(key, defaultValue)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message