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

    https://github.com/apache/spark/pull/3943#discussion_r23246057
  
    --- Diff: 
yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnSparkHadoopUtil.scala ---
    @@ -223,4 +225,43 @@ object YarnSparkHadoopUtil {
         )
       }
     
    +  /**
    +   * Expand environment variable using Yarn API.
    +   * If environment.$$() is implemented, return the result of it.
    +   * Otherwise, return the result of environment.$()
    +   * Note: $$() is added in Hadoop 2.4.
    +   */
    +  def expandEnvironment(environment: Environment): String = {
    +    var result = environment.$()
    +
    +    // We use reflection in order not to fail building with Hadoop 2.3 or 
before.
    +    val clazz = classOf[Environment]
    +    val name = "$$"
    +    if (clazz.getMethods().exists(_.getName == name)){
    +      val method = clazz.getMethod(name)
    +      result = method.invoke(environment).asInstanceOf[String]
    +    }
    +
    +    result
    +  }
    +
    +  /**
    +   * Get class path separator using Yarn API.
    +   * If ApplicationConstants.CLASS_PATH_SEPARATOR is implemented, return 
it.
    +   * Otherwise, return File.pathSeparator
    +   * Note: File.pathSeparator is added in Hadoop 2.4.
    +   */
    +  def getClassPathSeparator(): String = {
    +    var result = File.pathSeparator
    +
    +    // We use reflection in order not to fail building with Hadoop 2.3 or 
before.
    +    val clazz = classOf[ApplicationConstants]
    +    val name = "CLASS_PATH_SEPARATOR"
    +    if (clazz.getFields().exists(_.getName == name)){
    --- End diff --
    
    Similar comment to the above.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to