Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17087#discussion_r116611382
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
 ---
    @@ -899,8 +902,16 @@ object CodeGenerator extends Logging {
       /**
        * Compile the Java source code into a Java class, using Janino.
        */
    -  def compile(code: CodeAndComment): GeneratedClass = {
    +  def compile(code: CodeAndComment): GeneratedClass = try {
         cache.get(code)
    +  } catch {
    +    // Cache.get() may wrap the original exception. See the following URL
    +    // 
http://google.github.io/guava/releases/14.0/api/docs/com/google/common/cache/
    +    //   Cache.html#get(K,%20java.util.concurrent.Callable)
    +    case e @ (_: UncheckedExecutionException | _: ExecutionError) =>
    +      val excChains = ExceptionUtils.getThrowables(e)
    +      val exc = if (excChains.length == 1) excChains(0) else 
excChains(excChains.length - 2)
    +      throw exc
    --- End diff --
    
    Why not use `e.getCause`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to