Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Won't Fix
-
3.1.0
-
None
-
None
Description
There are some code like "InstanceOfOption == Some(value)",
for example "TaskSetManager#handleSuccessfulTask" method:
def handleSuccessfulTask(tid: Long, result: DirectTaskResult[_]): Unit = { ... if (successful(index) && killedByOtherAttempt.contains(tid)) { ... val resultSizeAcc = result.accumUpdates.find(a => a.name == Some(InternalAccumulator.RESULT_SIZE)) ... }
We need create a new Option instance "Some(InternalAccumulator.RESULT_SIZE)" to compare equivalently with a.name.
In this scenario, can use the "Option#contains" method to avoid creating new option instance