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

    https://github.com/apache/spark/pull/1486#discussion_r17768928
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskLocation.scala 
---
    @@ -22,13 +22,35 @@ package org.apache.spark.scheduler
      * In the latter case, we will prefer to launch the task on that 
executorID, but our next level
      * of preference will be executors on the same host if this is not 
possible.
      */
    -private[spark]
    -class TaskLocation private (val host: String, val executorId: 
Option[String]) extends Serializable {
    -  override def toString: String = "TaskLocation(" + host + ", " + 
executorId + ")"
    +private[spark] sealed abstract class TaskLocation(val host: String) {
    +}
    +
    +private [spark] case class ExecutorCacheTaskLocation(override val host: 
String,
    +    val executorId: String) extends TaskLocation(host) {
    +}
    +
    +private [spark] case class HDFSCachedTaskLocation(override val host: 
String)
    +    extends TaskLocation(host) {
    +  override def toString = TaskLocation.in_memory_location_tag + host
    +}
    +
    +private [spark] case class HostTaskLocation(override val host: String) 
extends TaskLocation(host) {
    --- End diff --
    
    Minor, but `override val` on something that exports the same parameter is 
kinda weird, I think this could be cleaned up just slightly by making 
TaskLocation a trait instead with a `def host: String`. Then this still works 
and is the sole implementation.


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