Skip to content

Commit

Permalink
[MINOR][CORE] Remove import scala.collection.Set in TaskSchedulerImpl
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?

I was playing with the scheduler and found this weird thing. In `TaskSchedulerImpl` we import `scala.collection.Set` without any reason. This is bad in practice, as it silently changes the actual class when we simply type `Set`, which by default should point to the immutable set.

This change only affects one method: `getExecutorsAliveOnHost`. I checked all the caller side and none of them need a general `Set` type.

## How was this patch tested?

N/A

Closes #24231 from cloud-fan/minor.

Authored-by: Wenchen Fan <wenchen@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
  • Loading branch information
cloud-fan authored and HyukjinKwon committed Mar 28, 2019
1 parent 39577a2 commit e4a968d
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import java.util.{Locale, Timer, TimerTask}
import java.util.concurrent.{ConcurrentHashMap, TimeUnit}
import java.util.concurrent.atomic.AtomicLong

import scala.collection.Set
import scala.collection.mutable.{ArrayBuffer, BitSet, HashMap, HashSet}
import scala.util.Random

Expand Down Expand Up @@ -829,8 +828,8 @@ private[spark] class TaskSchedulerImpl(
* Get a snapshot of the currently blacklisted nodes for the entire application. This is
* thread-safe -- it can be called without a lock on the TaskScheduler.
*/
def nodeBlacklist(): scala.collection.immutable.Set[String] = {
blacklistTrackerOpt.map(_.nodeBlacklist()).getOrElse(scala.collection.immutable.Set())
def nodeBlacklist(): Set[String] = {
blacklistTrackerOpt.map(_.nodeBlacklist()).getOrElse(Set.empty)
}

// By default, rack is unknown
Expand Down

0 comments on commit e4a968d

Please sign in to comment.