[ 
https://issues.apache.org/jira/browse/FLINK-3197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15089430#comment-15089430
 ] 

ASF GitHub Bot commented on FLINK-3197:
---------------------------------------

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

    https://github.com/apache/flink/pull/1494#discussion_r49205022
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/api/common/io/BinaryInputFormat.java 
---
    @@ -213,9 +213,10 @@ protected SequentialStatistics 
createStatistics(List<FileStatus> files, FileBase
     
                        FSDataInputStream fdis = 
file.getPath().getFileSystem().open(file.getPath(), blockInfo.getInfoSize());
                        fdis.seek(file.getLen() - blockInfo.getInfoSize());
    -                   
    +
                        blockInfo.read(new DataInputViewStreamWrapper(fdis));
                        totalCount += blockInfo.getAccumulatedRecordCount();
    +                   fdis.close();
    --- End diff --
    
    +1, or to use the try with resources construct.


> InputStream not closed in BinaryInputFormat#createStatistics
> ------------------------------------------------------------
>
>                 Key: FLINK-3197
>                 URL: https://issues.apache.org/jira/browse/FLINK-3197
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Priority: Minor
>
> Here is related code:
> {code}
>       FSDataInputStream fdis = 
> file.getPath().getFileSystem().open(file.getPath(), blockInfo.getInfoSize());
>       fdis.seek(file.getLen() - blockInfo.getInfoSize());
>       blockInfo.read(new DataInputViewStreamWrapper(fdis));
>       totalCount += blockInfo.getAccumulatedRecordCount();
> {code}
> fdis / wrapper should be closed upon leaving the method



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to