This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 32fc7f5  [SPARK-33589][SQL][FOLLOWUP] Replace Throwable with NonFatal
32fc7f5 is described below

commit 32fc7f5d4e48e3fafdc683680d0c363ab323658a
Author: Yuming Wang <[email protected]>
AuthorDate: Sun Dec 13 14:52:26 2020 -0800

    [SPARK-33589][SQL][FOLLOWUP] Replace Throwable with NonFatal
    
    ### What changes were proposed in this pull request?
    
    This pr replace `Throwable` with `NonFatal`.
    
    ### Why are the changes needed?
    
    Improve code.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    N/A
    
    Closes #30744 from wangyum/SPARK-33589-2.
    
    Authored-by: Yuming Wang <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
    (cherry picked from commit 94bc2d61a2598d995df8eb79fe450b0e5f6d7582)
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../spark/sql/hive/thriftserver/SparkSQLSessionManager.scala      | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLSessionManager.scala
 
b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLSessionManager.scala
index 0c092ab..89aaa31 100644
--- 
a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLSessionManager.scala
+++ 
b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLSessionManager.scala
@@ -17,6 +17,8 @@
 
 package org.apache.spark.sql.hive.thriftserver
 
+import scala.util.control.NonFatal
+
 import org.apache.hadoop.hive.conf.HiveConf
 import org.apache.hive.service.cli.{HiveSQLException, SessionHandle}
 import org.apache.hive.service.cli.session.SessionManager
@@ -73,12 +75,12 @@ private[hive] class SparkSQLSessionManager(hiveServer: 
HiveServer2, sqlContext:
       sparkSqlOperationManager.sessionToContexts.put(sessionHandle, ctx)
       sessionHandle
     } catch {
-      case e: Exception =>
+      case NonFatal(e) =>
         try {
           closeSession(sessionHandle)
         } catch {
-          case t: Throwable =>
-            logWarning("Error closing session", t)
+          case NonFatal(inner) =>
+            logWarning("Error closing session", inner)
         }
         throw new HiveSQLException("Failed to open new session: " + e, e)
     }


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

Reply via email to