Return-Path: X-Original-To: apmail-spark-commits-archive@minotaur.apache.org Delivered-To: apmail-spark-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 32D5D17E3C for ; Fri, 3 Oct 2014 02:32:38 +0000 (UTC) Received: (qmail 5297 invoked by uid 500); 3 Oct 2014 02:32:38 -0000 Delivered-To: apmail-spark-commits-archive@spark.apache.org Received: (qmail 5267 invoked by uid 500); 3 Oct 2014 02:32:38 -0000 Mailing-List: contact commits-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@spark.apache.org Received: (qmail 5257 invoked by uid 99); 3 Oct 2014 02:32:38 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Oct 2014 02:32:38 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B9E01A1E7DE; Fri, 3 Oct 2014 02:32:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: marmbrus@apache.org To: commits@spark.apache.org Message-Id: <49ddc361fde242b8a71f1f3862d8961c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [SQL] Initilize session state before creating CommandProcessor Date: Fri, 3 Oct 2014 02:32:37 +0000 (UTC) Repository: spark Updated Branches: refs/heads/master 42d5077fd -> 7de4e50a0 [SQL] Initilize session state before creating CommandProcessor With the old ordering it was possible for commands in the HiveDriver to NPE due to the lack of configuration in the threadlocal session state. Author: Michael Armbrust Closes #2635 from marmbrus/initOrder and squashes the following commits: 9749850 [Michael Armbrust] Initilize session state before creating CommandProcessor Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/7de4e50a Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/7de4e50a Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/7de4e50a Branch: refs/heads/master Commit: 7de4e50a01e90bcf88e0b721b2b15a5162373d56 Parents: 42d5077 Author: Michael Armbrust Authored: Thu Oct 2 19:32:21 2014 -0700 Committer: Michael Armbrust Committed: Thu Oct 2 19:32:21 2014 -0700 ---------------------------------------------------------------------- .../src/main/scala/org/apache/spark/sql/hive/HiveContext.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/7de4e50a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala ---------------------------------------------------------------------- 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 fdb5690..8bcc098 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 @@ -281,13 +281,14 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) { */ protected def runHive(cmd: String, maxRows: Int = 1000): Seq[String] = { try { + // Session state must be initilized before the CommandProcessor is created . + SessionState.start(sessionState) + val cmd_trimmed: String = cmd.trim() val tokens: Array[String] = cmd_trimmed.split("\\s+") val cmd_1: String = cmd_trimmed.substring(tokens(0).length()).trim() val proc: CommandProcessor = CommandProcessorFactory.get(tokens(0), hiveconf) - SessionState.start(sessionState) - proc match { case driver: Driver => driver.init() --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org For additional commands, e-mail: commits-help@spark.apache.org