[ 
https://issues.apache.org/jira/browse/SPARK-13371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guoqiang Li updated SPARK-13371:
--------------------------------
    Description: 
{noformat}
TaskSetManager.dequeueSpeculativeTask compares Option[String] and String 
directly.
{noformat}
Ths code: 
https://github.com/apache/spark/blob/87abcf7df921a5937fdb2bae8bfb30bfabc4970a/core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala#L344

{code}
 if (TaskLocality.isAllowed(locality, TaskLocality.RACK_LOCAL)) {
    for (rack <- sched.getRackForHost(host)) {
      for (index <- speculatableTasks if canRunOnHost(index)) {
        val racks = 
tasks(index).preferredLocations.map(_.host).map(sched.getRackForHost)
        // racks: Seq[Option[String]] and rack: String
        if (racks.contains(rack)) {
          speculatableTasks -= index
          return Some((index, TaskLocality.RACK_LOCAL))
        }
      }
    }
  }
{code}

  was:
{noformat}
TaskSetManager.dequeueSpeculativeTask compares  Option[String] and String 
directly.
{noformat}
Ths code: 
https://github.com/apache/spark/blob/87abcf7df921a5937fdb2bae8bfb30bfabc4970a/core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala#L344

{code}
 if (TaskLocality.isAllowed(locality, TaskLocality.RACK_LOCAL)) {
    for (rack <- sched.getRackForHost(host)) {
      for (index <- speculatableTasks if canRunOnHost(index)) {
        val racks = 
tasks(index).preferredLocations.map(_.host).map(sched.getRackForHost)
        // racks: Seq[Option[String]] and rack: String
        if (racks.contains(rack)) {
          speculatableTasks -= index
          return Some((index, TaskLocality.RACK_LOCAL))
        }
      }
    }
  }
{code}


> Compare Option[String] and String directly
> ------------------------------------------
>
>                 Key: SPARK-13371
>                 URL: https://issues.apache.org/jira/browse/SPARK-13371
>             Project: Spark
>          Issue Type: Bug
>          Components: Scheduler
>    Affects Versions: 1.5.2, 1.6.0
>            Reporter: Guoqiang Li
>
> {noformat}
> TaskSetManager.dequeueSpeculativeTask compares Option[String] and String 
> directly.
> {noformat}
> Ths code: 
> https://github.com/apache/spark/blob/87abcf7df921a5937fdb2bae8bfb30bfabc4970a/core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala#L344
> {code}
>  if (TaskLocality.isAllowed(locality, TaskLocality.RACK_LOCAL)) {
>     for (rack <- sched.getRackForHost(host)) {
>       for (index <- speculatableTasks if canRunOnHost(index)) {
>         val racks = 
> tasks(index).preferredLocations.map(_.host).map(sched.getRackForHost)
>         // racks: Seq[Option[String]] and rack: String
>         if (racks.contains(rack)) {
>           speculatableTasks -= index
>           return Some((index, TaskLocality.RACK_LOCAL))
>         }
>       }
>     }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to