Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/9175#discussion_r42467209
--- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
---
@@ -931,24 +936,12 @@ class DAGScheduler(
stage.pendingPartitions.clear()
// First figure out the indexes of partition ids to compute.
- val (allPartitions: Seq[Int], partitionsToCompute: Seq[Int]) = {
- stage match {
- case stage: ShuffleMapStage =>
- val allPartitions = 0 until stage.numPartitions
- val filteredPartitions = allPartitions.filter { id =>
stage.outputLocs(id).isEmpty }
- (allPartitions, filteredPartitions)
- case stage: ResultStage =>
- val job = stage.resultOfJob.get
- val allPartitions = 0 until job.numPartitions
- val filteredPartitions = allPartitions.filter { id =>
!job.finished(id) }
- (allPartitions, filteredPartitions)
- }
- }
+ val partitionsToCompute: Seq[Int] = stage.findMissingPartitions()
// Create internal accumulators if the stage has no accumulators
initialized.
// Reset internal accumulators only if this stage is not partially
submitted
// Otherwise, we may override existing accumulator values from some
tasks
- if (stage.internalAccumulators.isEmpty || allPartitions ==
partitionsToCompute) {
+ if (stage.internalAccumulators.isEmpty || stage.numPartitions ==
partitionsToCompute.size) {
--- End diff --
This tiny rewrite should also improve scheduler performance slightly, since
the if check just needs to check size, not the actual comparison.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]