Yicong Huang created SPARK-54930:
------------------------------------

             Summary: Remove redundant _accumulatorRegistry.clear() call in 
worker.py
                 Key: SPARK-54930
                 URL: https://issues.apache.org/jira/browse/SPARK-54930
             Project: Spark
          Issue Type: Improvement
          Components: PySpark
    Affects Versions: 4.1.0
            Reporter: Yicong Huang


In {{worker.py}}, {{_accumulatorRegistry.clear()}} is called twice with no 
accumulator-modifying code in between:

{code:python}
shuffle.MemoryBytesSpilled = 0
shuffle.DiskBytesSpilled = 0
_accumulatorRegistry.clear()  # first call

setup_spark_files(infile)
setup_broadcasts(infile)

_accumulatorRegistry.clear()  # second call (redundant)
{code}

Neither {{setup_spark_files}} nor {{setup_broadcasts}} adds anything to 
{{_accumulatorRegistry}}, so the first {{clear()}} is redundant.

This happened because SPARK-3463 (2014) added the first {{clear()}} and 
SPARK-3030 (2014) added the second one. When SPARK-44533 (2023) refactored the 
code to extract {{setup_spark_files}} and {{setup_broadcasts}}, both 
{{clear()}} calls were preserved even though they became redundant.




--
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