Github user vanzin commented on a diff in the pull request: https://github.com/apache/spark/pull/2241#discussion_r18179030 --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala --- @@ -284,24 +287,20 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) { 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) + val proc: CommandProcessor = HiveShim.getCommandProcessor(Array(tokens(0)), hiveconf) proc match { case driver: Driver => - driver.init() - val results = new JArrayList[String] val response: CommandProcessorResponse = driver.run(cmd) // Throw an exception if there is an error in query processing. if (response.getResponseCode != 0) { - driver.destroy() + driver.close() throw new QueryExecutionException(response.getErrorMessage) } driver.setMaxRows(maxRows) driver.getResults(results) - driver.destroy() + driver.close() --- End diff -- A quick question since I ran into something similar when trying to run things on 0.13: can the driver be re-used after you call `close()`? Because I don't see the driver being removed from the CommandProcessorFactory cache, so another call to `runHive` will reuse the closed driver. (I ran into this when running the `HiveFromSpark` example compiled against Hive 0.13, so it should be easy to check.)
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org