[
https://issues.apache.org/jira/browse/SPARK-59428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated SPARK-59428:
-----------------------------------
Labels: pull-request-available (was: )
> 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
> Priority: Trivial
> Labels: pull-request-available
>
> 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]