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

    https://github.com/apache/spark/pull/14659#discussion_r78898257
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -2418,6 +2418,21 @@ private[spark] object Utils extends Logging {
           sparkJars.map(_.split(",")).map(_.filter(_.nonEmpty)).toSeq.flatten
         }
       }
    +
    +  def setCallerContext(context: String): Boolean = {
    +    var succeed = false
    +    try {
    +      val Builder = 
Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
    +      val builderInst = 
Builder.getConstructor(classOf[String]).newInstance(context)
    +      val ret = Builder.getMethod("build").invoke(builderInst)
    +      val callerContext = 
Utils.classForName("org.apache.hadoop.ipc.CallerContext")
    --- End diff --
    
    If make `val callerContext = 
Utils.classForName("org.apache.hadoop.ipc.CallerContext")` out of `try` block, 
Spark will throw exception when it runs on hadoop before 2.8.0. Also, moving 
that line to the first of `try` block does not make any difference since 
`Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")` also needs 
to check if `org.apache.hadoop.ipc.CallerContext` exists. I am not sure if I 
got your point, could you please give more info about it? Thanks a lot.


---
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