cloud-fan commented on code in PR #45438:
URL: https://github.com/apache/spark/pull/45438#discussion_r1519136321


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala:
##########
@@ -540,10 +540,11 @@ object QueryExecution {
   }
 
   /**
-   * Converts asserts, null pointer exceptions to internal errors.
+   * Converts asserts, null pointer exceptions and scala match errors to 
internal errors.
    */
   private[sql] def toInternalError(msg: String, e: Throwable): Throwable = e 
match {
-    case e @ (_: java.lang.NullPointerException | _: java.lang.AssertionError) 
=>
+    case e @ (_: java.lang.NullPointerException | _: java.lang.AssertionError |
+              _: scala.MatchError) =>

Review Comment:
   we can replace this case match by moving the logic to a new method to make 
the code more reable
   ```
   private def isInternalError(e: Throwable): Boolean = e match {
     case _: java.lang.NullPointerException => true
     case _: _: java.lang.AssertionError => true
     ...
     case _ => false
   }
   ```
   
   then the code here
   ```
   if (isInternalError(e)) {
     SparkException.internalError...
   } else {
     e
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to