Github user viirya commented on the pull request:

    https://github.com/apache/spark/pull/3600#issuecomment-66435647
  
    I agree with you that the saved operation here is a cheap one. :-) However 
the problem you mentioned would not happen with current version of 
`DeserializationStream`.
    
    Not all InputStream close their underlying stream when they are collected 
by GC. There are detailed discussions 
[here](http://www.coderanch.com/t/278165/java-io/java/InputStream-close-garbage-collection)
 and 
[there](http://stackoverflow.com/questions/1522370/does-input-outputstreams-close-on-destruction).
 I am sure that `FileInputStream` implements `finalize` to close underlying 
file. But other streams used here are not as the tests show.
    
    `DeserializationStream` is implemented in Spark and it has no such 
behavior. During modifying the codes, I checked it and found that you must 
explicitly call its `close` to close its underlying stream. That is why it 
passes the tests.
    
    I am ok to close this PR if it causes problem. But if it would not really 
cause the mentioned problem, I can not see why a slightly improved performance 
is bad.



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