From 04022108fc068a633e787b94849d08375079290b Mon Sep 17 00:00:00 2001 From: Tom Magrino Date: Wed, 22 Jun 2016 11:08:23 -0700 Subject: [PATCH 1/2] Fixed split command in TaskLocation to allow for _ in executor id. Also updated the comment to indicate the string format which includes the executor id. --- .../scala/org/apache/spark/scheduler/TaskLocation.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/scheduler/TaskLocation.scala b/core/src/main/scala/org/apache/spark/scheduler/TaskLocation.scala index 1eb6c1614fc0..ff48773ae875 100644 --- a/core/src/main/scala/org/apache/spark/scheduler/TaskLocation.scala +++ b/core/src/main/scala/org/apache/spark/scheduler/TaskLocation.scala @@ -64,14 +64,14 @@ private[spark] object TaskLocation { /** * Create a TaskLocation from a string returned by getPreferredLocations. - * These strings have the form [hostname] or hdfs_cache_[hostname], depending on whether the - * location is cached. + * These strings have the form [executorLocationTag][hostname][executorid], [hostname], or hdfs_cache_[hostname], + * depending on whether the location is cached. */ def apply(str: String): TaskLocation = { val hstr = str.stripPrefix(inMemoryLocationTag) if (hstr.equals(str)) { if (str.startsWith(executorLocationTag)) { - val splits = str.split("_") + val splits = str.split("_", 3) if (splits.length != 3) { throw new IllegalArgumentException("Illegal executor location format: " + str) } From 00fa60132e8f069e2eb1fb8fa4b0d39ccbb32cff Mon Sep 17 00:00:00 2001 From: Tom Magrino Date: Wed, 22 Jun 2016 11:20:39 -0700 Subject: [PATCH 2/2] Code style fix. --- .../main/scala/org/apache/spark/scheduler/TaskLocation.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/scheduler/TaskLocation.scala b/core/src/main/scala/org/apache/spark/scheduler/TaskLocation.scala index ff48773ae875..6d9a1cc2c99e 100644 --- a/core/src/main/scala/org/apache/spark/scheduler/TaskLocation.scala +++ b/core/src/main/scala/org/apache/spark/scheduler/TaskLocation.scala @@ -64,8 +64,8 @@ private[spark] object TaskLocation { /** * Create a TaskLocation from a string returned by getPreferredLocations. - * These strings have the form [executorLocationTag][hostname][executorid], [hostname], or hdfs_cache_[hostname], - * depending on whether the location is cached. + * These strings have the form [executorLocationTag][hostname][executorid], [hostname], or + * hdfs_cache_[hostname], depending on whether the location is cached. */ def apply(str: String): TaskLocation = { val hstr = str.stripPrefix(inMemoryLocationTag)