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

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17230565#comment-17230565 ] 

Apache Spark commented on SPARK-33431:
--------------------------------------

User 'LuciferYang' has created a pull request for this issue:
https://github.com/apache/spark/pull/30353

> 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