Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12693#discussion_r61870401
  
    --- Diff: 
core/src/main/scala/org/apache/spark/rdd/ReliableCheckpointRDD.scala ---
    @@ -243,7 +243,16 @@ private[spark] object ReliableCheckpointRDD extends 
Logging {
           if (fs.exists(partitionerFilePath)) {
             val fileInputStream = fs.open(partitionerFilePath, bufferSize)
             val serializer = SparkEnv.get.serializer.newInstance()
    -        val deserializeStream = 
serializer.deserializeStream(fileInputStream)
    +        // make sure that the file is closed if error occurrs during 
deserialization
    +        val deserializeStream =
    --- End diff --
    
    I'm not sure what you mean -- it's less code. Just open the 
deserializeStream inside the block and close it in the finally block that 
follows. Actually, closing deserializeStream will already (should already) 
close the underlying stream anyway. It doesn't handle errors while making the 
stream from the original stream, but, constructors of the deserializer streams 
aren't reading the stream anyway. I suspect it's fine as-is, but it would be 
extra-defensive to also close the fileInputStream, yes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to