Skip to content

Commit f244688

Browse files
committed
Review comments from michael
1 parent ed395be commit f244688

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/AbstractSparkSQLDriver.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
package org.apache.spark.sql.hive.thriftserver
1919

20-
import org.apache.spark.sql.AnalysisException
21-
2220
import scala.collection.JavaConversions._
2321

2422
import org.apache.commons.lang3.exception.ExceptionUtils
@@ -27,6 +25,7 @@ import org.apache.hadoop.hive.ql.Driver
2725
import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse
2826

2927
import org.apache.spark.Logging
28+
import org.apache.spark.sql.AnalysisException
3029
import org.apache.spark.sql.hive.{HiveContext, HiveMetastoreTypes}
3130

3231
private[hive] abstract class AbstractSparkSQLDriver(
@@ -92,5 +91,6 @@ private[hive] abstract class AbstractSparkSQLDriver(
9291
}
9392
}
9493

95-
private[hive] case class CommandProcessorResponseWrapper (rc : CommandProcessorResponse,
96-
cause : Throwable)
94+
private[hive] case class CommandProcessorResponseWrapper(
95+
rc : CommandProcessorResponse,
96+
cause : Throwable)

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@
1717

1818
package org.apache.spark.sql.hive.thriftserver
1919

20-
import scala.collection.JavaConversions._
21-
2220
import java.io._
2321
import java.util.{ArrayList => JArrayList}
24-
import org.apache.spark.sql.AnalysisException
2522

23+
import scala.collection.JavaConversions._
2624

2725
import jline.{ConsoleReader, History}
28-
2926
import org.apache.commons.lang3.StringUtils
3027
import org.apache.commons.logging.LogFactory
3128
import org.apache.hadoop.conf.Configuration
@@ -34,13 +31,14 @@ import org.apache.hadoop.hive.common.{HiveInterruptCallback, HiveInterruptUtils}
3431
import org.apache.hadoop.hive.conf.HiveConf
3532
import org.apache.hadoop.hive.ql.Driver
3633
import org.apache.hadoop.hive.ql.exec.Utilities
37-
import org.apache.hadoop.hive.ql.processors.{AddResourceProcessor, SetProcessor, CommandProcessor}
34+
import org.apache.hadoop.hive.ql.processors.{AddResourceProcessor, CommandProcessor, SetProcessor}
3835
import org.apache.hadoop.hive.ql.session.SessionState
3936
import org.apache.thrift.transport.TSocket
4037

4138
import org.apache.spark.Logging
39+
import org.apache.spark.sql.AnalysisException
4240
import org.apache.spark.sql.hive.{HiveContext, HiveShim}
43-
import org.apache.spark.util.{ShutdownHookManager, Utils}
41+
import org.apache.spark.util.ShutdownHookManager
4442

4543
private[hive] object SparkSQLCLIDriver {
4644
private var prompt = "spark-sql"
@@ -291,7 +289,7 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
291289
if (ret != 0) {
292290
// For analysis exception, only the error is printed out to the console.
293291
rcWrapper.cause match {
294-
case e : AnalysisException =>
292+
case e: AnalysisException =>
295293
err.println(s"""Error in query: ${e.getMessage}""")
296294
case _ => err.println(rcWrapper.rc.getErrorMessage())
297295
}

sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/CliSuite.scala

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class CliSuite extends SparkFunSuite with BeforeAndAfter with Logging {
5959
*
6060
* @param queriesAndExpectedAnswers one or more tupes of query + answer
6161
*/
62-
6362
def runCliWithin(
6463
timeout: FiniteDuration,
6564
extraArgs: Seq[String] = Seq.empty,
@@ -95,15 +94,14 @@ class CliSuite extends SparkFunSuite with BeforeAndAfter with Logging {
9594
foundAllExpectedAnswers.trySuccess(())
9695
}
9796
}
98-
else
99-
{
100-
errorResponses.foreach { r =>
101-
if (line.contains(r)) {
102-
foundAllExpectedAnswers.tryFailure(
103-
new RuntimeException(s"Failed with error line '$line'"))
104-
}
97+
else {
98+
errorResponses.foreach { r =>
99+
if (line.contains(r)) {
100+
foundAllExpectedAnswers.tryFailure(
101+
new RuntimeException(s"Failed with error line '$line'"))
105102
}
106103
}
104+
}
107105
}
108106

109107
// Searching expected output line from both stdout and stderr of the CLI process

0 commit comments

Comments
 (0)