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

Yang Jie updated SPARK-44999:
-----------------------------
    Summary: Refactor ExternalSorter to reduce checks on shouldPartition when 
calling getPartition  (was: Refactor ExternalSorter#getPartition to reduce 
checks on shouldPartition)

> Refactor ExternalSorter to reduce checks on shouldPartition when calling 
> getPartition
> -------------------------------------------------------------------------------------
>
>                 Key: SPARK-44999
>                 URL: https://issues.apache.org/jira/browse/SPARK-44999
>             Project: Spark
>          Issue Type: Improvement
>          Components: Spark Core
>    Affects Versions: 4.0.0
>            Reporter: Yang Jie
>            Priority: Minor
>
> {code:java}
>   private def getPartition(key: K): Int = {
>     if (shouldPartition) partitioner.get.getPartition(key) else 0
>   } {code}
>  
> The {{getPartition}} method checks {{shouldPartition}} every time it is 
> called. However, {{shouldPartition}} should not be able to change after the 
> {{ExternalSorter}} is instantiated. Therefore, it can be refactored to reduce 
> the checks on {{{}shouldPartition{}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to