@@ -27,10 +27,9 @@ import scala.collection.mutable.{ArrayBuffer, Map => SMap}
2727import scala .math ._
2828
2929import org .apache .hadoop .hive .conf .HiveConf
30+ import org .apache .hadoop .hive .metastore .api .FieldSchema
3031import org .apache .hadoop .hive .ql .metadata .Hive
31- import org .apache .hadoop .hive .ql .processors .CommandProcessorFactory
3232import org .apache .hadoop .hive .ql .session .SessionState
33- import org .apache .hadoop .hive .metastore .api .FieldSchema
3433import org .apache .hadoop .hive .shims .ShimLoader
3534import org .apache .hadoop .security .UserGroupInformation
3635import org .apache .hive .service .cli ._
@@ -39,9 +38,9 @@ import org.apache.hive.service.cli.session.HiveSession
3938
4039import org .apache .spark .Logging
4140import org .apache .spark .sql .catalyst .types ._
42- import org .apache .spark .sql .{Row => SparkRow , SchemaRDD }
43- import org .apache .spark .sql .hive .{HiveContext , HiveMetastoreTypes }
4441import org .apache .spark .sql .hive .thriftserver .ReflectionUtils ._
42+ import org .apache .spark .sql .hive .{HiveContext , HiveMetastoreTypes }
43+ import org .apache .spark .sql .{SchemaRDD , Row => SparkRow }
4544
4645/**
4746 * A compatibility layer for interacting with Hive version 0.12.0.
@@ -100,6 +99,7 @@ private[hive] class SparkExecuteStatementOperation(
10099 // Actually do need to catch Throwable as some failures don't inherit from Exception and
101100 // HiveServer will silently swallow them.
102101 case e : Throwable =>
102+ setState(OperationState .ERROR )
103103 logError(" Error executing query:" ,e)
104104 throw new HiveSQLException (e.toString)
105105 }
@@ -194,14 +194,12 @@ private[hive] class SparkExecuteStatementOperation(
194194 try {
195195 sqlOperationConf.verifyAndSet(confEntry.getKey, confEntry.getValue)
196196 }
197- catch {
198- case e : IllegalArgumentException => {
199- throw new HiveSQLException (" Error applying statement specific settings" , e)
200- }
197+ catch { case e : IllegalArgumentException =>
198+ throw new HiveSQLException (" Error applying statement specific settings" , e)
201199 }
202200 }
203201 }
204- return sqlOperationConf
202+ sqlOperationConf
205203 }
206204
207205 def run (): Unit = {
@@ -219,7 +217,7 @@ private[hive] class SparkExecuteStatementOperation(
219217 val currentUGI : UserGroupInformation = ShimLoader .getHadoopShims.getUGIForConf(opConfig)
220218
221219 val backgroundOperation : Runnable = new Runnable {
222- def run {
220+ def run () {
223221 val doAsAction : PrivilegedExceptionAction [AnyRef ] =
224222 new PrivilegedExceptionAction [AnyRef ] {
225223 def run : AnyRef = {
@@ -228,23 +226,19 @@ private[hive] class SparkExecuteStatementOperation(
228226 try {
229227 runInternal(statement)
230228 }
231- catch {
232- case e : HiveSQLException => {
233- setOperationException(e)
234- logError(" Error running hive query: " , e)
235- }
229+ catch { case e : HiveSQLException =>
230+ setOperationException(e)
231+ logError(" Error running hive query: " , e)
236232 }
237- return null
233+ null
238234 }
239235 }
240236 try {
241237 ShimLoader .getHadoopShims.doAs(currentUGI, doAsAction)
242238 }
243- catch {
244- case e : Exception => {
245- setOperationException(new HiveSQLException (e))
246- logError(" Error running hive query as user : " + currentUGI.getShortUserName, e)
247- }
239+ catch { case e : Exception =>
240+ setOperationException(new HiveSQLException (e))
241+ logError(" Error running hive query as user : " + currentUGI.getShortUserName, e)
248242 }
249243 setState(OperationState .FINISHED )
250244 }
0 commit comments