You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean R. Owen (Jira)" <ji...@apache.org> on 2020/12/07 15:46:00 UTC

[jira] [Resolved] (SPARK-33431) Simplifying equality of the instance of Option and Some(value)

     [ https://issues.apache.org/jira/browse/SPARK-33431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean R. Owen resolved SPARK-33431.
----------------------------------
    Resolution: Won't Fix

> Simplifying equality of the instance of Option and Some(value)
> --------------------------------------------------------------
>
>                 Key: SPARK-33431
>                 URL: https://issues.apache.org/jira/browse/SPARK-33431
>             Project: Spark
>          Issue Type: Improvement
>          Components: Spark Core, SQL
>    Affects Versions: 3.1.0
>            Reporter: Yang Jie
>            Priority: Minor
>
> There are some code like "InstanceOfOption == Some(value)",
> for example "TaskSetManager#handleSuccessfulTask" method:
> {code:java}
> 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)) 
>     ...
> }
> {code}
> 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
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org