[
https://issues.apache.org/jira/browse/SPARK-44999?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yang Jie updated SPARK-44999:
-----------------------------
Description:
{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{}}}.
was:
{code:java}
private def getPartition(key: K): Int = {
if (shouldPartition) partitioner.get.getPartition(key) else 0
} {code}
> Refactor `ExternalSorter#getPartition` to reduce the number of i`f else`
> judgments
> ----------------------------------------------------------------------------------
>
> 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: [email protected]
For additional commands, e-mail: [email protected]