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

Uroš Bojanić resolved SPARK-59428.
----------------------------------
    Fix Version/s: 4.4.0
       Resolution: Fixed

Issue resolved by pull request 58727
[https://github.com/apache/spark/pull/58727]

> Remove a dead emptiness guard in CollectFrequentItems.
> ------------------------------------------------------
>
>                 Key: SPARK-59428
>                 URL: https://issues.apache.org/jira/browse/SPARK-59428
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 4.1.0
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Trivial
>              Labels: pull-request-available
>             Fix For: 4.4.0
>
>
> h2. Change
> Drop the guard and call {{min}} directly:
> {code:scala}
> // Non-empty here: this branch runs only when map.size >= size, and size > 0.
> val minCount = map.values.min
> {code}
> This removes the dead branch and one of the two {{map.values}} allocations on 
> the eviction path. (HotSpot escape analysis may already scalar-replace the 
> short-lived wrapper in hot compiled code, but that is not guaranteed; 
> removing it at the source level does not rely on the JIT.)
> h2. Does this PR introduce _any_ user-facing change?
> No. The map is provably non-empty at this point, so the removed branch never 
> executed; results are identical.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to