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

    https://github.com/apache/spark/pull/1486#discussion_r15495876
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/HadoopRDD.scala ---
    @@ -272,4 +289,49 @@ private[spark] object HadoopRDD {
         conf.setInt("mapred.task.partition", splitId)
         conf.set("mapred.job.id", jobID.toString)
       }
    +
    +  private[spark] class NewHadoopClasses {
    +    val inputSplitWithLocationInfo =
    +      Class.forName("org.apache.hadoop.mapred.InputSplitWithLocationInfo")
    +    val getLocationInfo =
    +      inputSplitWithLocationInfo.getMethod("getLocationInfo")
    +    val newInputSplit = 
    +      Class.forName("org.apache.hadoop.mapreduce.InputSplit")
    +    val newGetLocationInfo =
    +      newInputSplit.getMethod("getLocationInfo")
    +    val splitLocationInfo =
    +      Class.forName("org.apache.hadoop.mapred.SplitLocationInfo")
    +    val isInMemory = splitLocationInfo.getMethod("isInMemory")
    +    val getLocation = splitLocationInfo.getMethod("getLocation")
    +  }
    +
    +  private[spark] val NEW_HADOOP_CLASSES = try {
    +    Some(new NewHadoopClasses)
    +  } catch {
    +    case e: Exception =>
    +      logInfo("SplitLocationInfo and other new Hadoop classes are " +
    +          "unavailable. Using the older Hadoop location info code.", e)
    +      //WATERMELON
    +      None
    +  }
    +
    +  private[spark] def convertSplitLocationInfo(infos : Array[Object]) : 
Seq[String] = {
    +    val out = new ListBuffer[String]
    +    infos.foreach(loc => {
    +      val locationStr = HadoopRDD.NEW_HADOOP_CLASSES.get.
    +        getLocation.invoke(loc).asInstanceOf[String]
    +      if (locationStr != "localhost") {
    +        if (HadoopRDD.NEW_HADOOP_CLASSES.get.isInMemory.
    +                invoke(loc).asInstanceOf[Boolean]) {
    +          logInfo("Partition " + locationStr + " is cached by Hadoop.") // 
WATERMELON
    --- End diff --
    
    Wait, watermelon?


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

Reply via email to