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

    https://github.com/apache/spark/pull/2241#discussion_r18944242
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala ---
    @@ -288,23 +290,26 @@ 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)
    +      val proc: CommandProcessor = 
HiveShim.getCommandProcessor(Array(tokens(0)), hiveconf)
     
           proc match {
             case driver: Driver =>
    -          driver.init()
    -
    -          val results = new JArrayList[String]
    +          val results = HiveShim.createDriverResultsArray
               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()
    -          results
    +          driver.close()
    +          results.map { r =>
    +            r match {
    +              case s: String => s
    +              case o => o.toString
    --- End diff --
    
    Here ```r``` maybe a ```Array``` 
type(https://github.com/scwf/hive/blob/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/FetchFormatter.java#L53-L64),
 we should cover that case, otherwise this will lead to console result printed 
as follows:
    ``` result
       [Object@5e41108b
    ```
       
    And on the other hand i suggest that we should do some tests with this PR 
merged with #2685 to check the basic functionality
        
    
     


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to