daugraph opened a new pull request #33957:
URL: https://github.com/apache/spark/pull/33957


   ### What changes were proposed in this pull request?
   Incorrect order of variable initialization may lead to incorrect behavior, 
Related code: TorrentBroadcast.scala , TorrentBroadCast will get wrong 
checksumEnabled value after initialization, this may not be what we need, we 
can move L94 front of setConf(SparkEnv.get.conf) to avoid this.
   
   Supplement:
   ```scala
   class Broadcast {
     def setConf(): Unit = {
       checksumEnabled = true
     }
     setConf()
     var checksumEnabled = false
   }
   println(new Broadcast().checksumEnabled)
   ```
   output:
   ```scala
   false
   ```
    
   ```scala
   class Broadcast {
     var checksumEnabled = false
     def setConf(): Unit = {
       checksumEnabled = true
     }
     setConf()
   }
   println(new Broadcast().checksumEnabled)
   ```
   output: 
   ```scala
   true
   ```
   
   
   ### Why are the changes needed?
   we can move L94 front of setConf(SparkEnv.get.conf) to avoid this.
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   No
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to