Github user zhzhan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2241#discussion_r18186480
  
    --- 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 --
    
    My understanding is that the driver is not removed from mapDriver of 
CommandProcessorFactory, and will be reused.
    
    CommandProcessorFactory.clean(hiveConf) will destroy and remove the driver 
from mapDriver.


---
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

Reply via email to