File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed
src/main/scala/org/apache/spark/sql/hive
v0.12.0/src/main/scala/org/apache/spark/sql/hive
v0.13.1/src/main/scala/org/apache/spark/sql/hive Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -293,7 +293,7 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
293293
294294 proc match {
295295 case driver : Driver =>
296- val results = new JArrayList [ String ]
296+ val results = HiveShim .createDriverResultsArray
297297 val response : CommandProcessorResponse = driver.run(cmd)
298298 // Throw an exception if there is an error in query processing.
299299 if (response.getResponseCode != 0 ) {
@@ -303,7 +303,12 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
303303 driver.setMaxRows(maxRows)
304304 driver.getResults(results)
305305 driver.close()
306- results
306+ results.map { r =>
307+ r match {
308+ case s : String => s
309+ case o => o.toString
310+ }
311+ }
307312 case _ =>
308313 sessionState.out.println(tokens(0 ) + " " + cmd_1)
309314 Seq (proc.run(cmd_1).getResponseCode.toString)
Original file line number Diff line number Diff line change 1818package org .apache .spark .sql .hive
1919
2020import java .net .URI
21+ import java .util .{ArrayList => JArrayList }
2122import java .util .Properties
2223import org .apache .hadoop .conf .Configuration
2324import org .apache .hadoop .fs .Path
@@ -49,14 +50,16 @@ private[hive] object HiveShim {
4950 new TableDesc (serdeClass, inputFormatClass, outputFormatClass, properties)
5051 }
5152
53+ def createDriverResultsArray = new JArrayList [String ]
54+
5255 def getStatsSetupConstTotalSize = StatsSetupConst .TOTAL_SIZE
5356
54- def createDefaultDBIfNeeded (context : HiveContext ) = { }
57+ def createDefaultDBIfNeeded (context : HiveContext ) = { }
5558
5659 /** The string used to denote an empty comments field in the schema. */
5760 def getEmptyCommentsFieldValue = " None"
5861
59- def getCommandProcessor (cmd : Array [String ], conf : HiveConf ) = {
62+ def getCommandProcessor (cmd : Array [String ], conf : HiveConf ) = {
6063 CommandProcessorFactory .get(cmd(0 ), conf)
6164 }
6265
Original file line number Diff line number Diff line change 1717
1818package org .apache .spark .sql .hive
1919
20+ import java .util .{ArrayList => JArrayList }
2021import java .util .Properties
2122import org .apache .hadoop .conf .Configuration
2223import org .apache .hadoop .fs .Path
@@ -53,17 +54,19 @@ private[hive] object HiveShim {
5354 new TableDesc (inputFormatClass, outputFormatClass, properties)
5455 }
5556
57+ def createDriverResultsArray = new JArrayList [Object ]
58+
5659 def getStatsSetupConstTotalSize = StatsSetupConst .TOTAL_SIZE
5760
58- def createDefaultDBIfNeeded (context : HiveContext ) = {
61+ def createDefaultDBIfNeeded (context : HiveContext ) = {
5962 context.runSqlHive(" CREATE DATABASE default" )
6063 context.runSqlHive(" USE default" )
6164 }
6265
6366 /* The string used to denote an empty comments field in the schema. */
6467 def getEmptyCommentsFieldValue = " "
6568
66- def getCommandProcessor (cmd : Array [String ], conf : HiveConf ) = {
69+ def getCommandProcessor (cmd : Array [String ], conf : HiveConf ) = {
6770 CommandProcessorFactory .get(cmd, conf)
6871 }
6972
You can’t perform that action at this time.
0 commit comments