Skip to content

Commit 7856253

Browse files
srowenAndrew Or
authored andcommitted
[SPARK-13371][CORE][STRING] TaskSetManager.dequeueSpeculativeTask compares Option and String directly.
## What changes were proposed in this pull request? Fix some comparisons between unequal types that cause IJ warnings and in at least one case a likely bug (TaskSetManager) ## How was the this patch tested? Running Jenkins tests Author: Sean Owen <[email protected]> Closes #11253 from srowen/SPARK-13371.
1 parent 892b2dd commit 7856253

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

core/src/main/scala/org/apache/spark/deploy/FaultToleranceTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ private object FaultToleranceTest extends App with Logging {
252252
val f = Future {
253253
try {
254254
val res = sc.parallelize(0 until 10).collect()
255-
assertTrue(res.toList == (0 until 10))
255+
assertTrue(res.toList == (0 until 10).toList)
256256
true
257257
} catch {
258258
case e: Exception =>

core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ private[spark] class TaskSetManager(
338338
if (TaskLocality.isAllowed(locality, TaskLocality.RACK_LOCAL)) {
339339
for (rack <- sched.getRackForHost(host)) {
340340
for (index <- speculatableTasks if canRunOnHost(index)) {
341-
val racks = tasks(index).preferredLocations.map(_.host).map(sched.getRackForHost)
341+
val racks = tasks(index).preferredLocations.map(_.host).flatMap(sched.getRackForHost)
342342
if (racks.contains(rack)) {
343343
speculatableTasks -= index
344344
return Some((index, TaskLocality.RACK_LOCAL))

core/src/test/scala/org/apache/spark/CheckpointSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ trait RDDCheckpointTester { self: SparkFunSuite =>
5454
// Generate the final RDD using given RDD operation
5555
val baseRDD = generateFatRDD()
5656
val operatedRDD = op(baseRDD)
57-
val parentRDD = operatedRDD.dependencies.headOption.orNull
57+
val parentDependency = operatedRDD.dependencies.headOption.orNull
5858
val rddType = operatedRDD.getClass.getSimpleName
5959
val numPartitions = operatedRDD.partitions.length
6060

@@ -82,7 +82,7 @@ trait RDDCheckpointTester { self: SparkFunSuite =>
8282
}
8383

8484
// Test whether dependencies have been changed from its earlier parent RDD
85-
assert(operatedRDD.dependencies.head.rdd != parentRDD)
85+
assert(operatedRDD.dependencies.head != parentDependency)
8686

8787
// Test whether the partitions have been changed from its earlier partitions
8888
assert(operatedRDD.partitions.toList != partitionsBeforeCheckpoint.toList)

core/src/test/scala/org/apache/spark/PartitioningSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ class PartitioningSuite extends SparkFunSuite with SharedSparkContext with Priva
163163
val hashP2 = new HashPartitioner(2)
164164
assert(rangeP2 === rangeP2)
165165
assert(hashP2 === hashP2)
166-
assert(hashP2 != rangeP2)
167-
assert(rangeP2 != hashP2)
166+
assert(hashP2 !== rangeP2)
167+
assert(rangeP2 !== hashP2)
168168
}
169169

170170
test("partitioner preservation") {

core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,11 @@ class UISeleniumSuite extends SparkFunSuite with WebBrowser with Matchers with B
289289
JInt(stageId) <- stage \ "stageId"
290290
JInt(attemptId) <- stage \ "attemptId"
291291
} {
292-
val exp = if (attemptId == 0 && stageId == 1) StageStatus.FAILED else StageStatus.COMPLETE
292+
val exp = if (attemptId.toInt == 0 && stageId.toInt == 1) {
293+
StageStatus.FAILED
294+
} else {
295+
StageStatus.COMPLETE
296+
}
293297
status should be (exp.name())
294298
}
295299

0 commit comments

Comments
 (0)