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

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

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

    https://github.com/apache/flink/pull/1903#discussion_r61078670
  
    --- Diff: 
flink-runtime/src/test/java/org/apache/flink/runtime/operators/DataSourceTaskTest.java
 ---
    @@ -84,17 +84,26 @@ public void testDataSourceTask() {
                super.addOutput(this.outList);
                
                DataSourceTask<Record> testTask = new DataSourceTask<>();
    -           
                super.registerFileInputTask(testTask, MockInputFormat.class, 
new File(tempTestPath).toURI().toString(), "\n");
    -           
    +
                try {
                        testTask.invoke();
                } catch (Exception e) {
                        System.err.println(e);
                        Assert.fail("Invoke method caused exception.");
                }
                
    -           Assert.assertTrue("Invalid output size. Expected: 
"+(keyCnt*valCnt)+" Actual: "+this.outList.size(),
    +           try {
    +                   Field formatField = 
DataSourceTask.class.getDeclaredField("format");
    +                   formatField.setAccessible(true);
    +                   MockInputFormat inputFormat = (MockInputFormat) 
formatField.get(testTask);
    +                   Assert.assertTrue("Invalid status of the input format. 
Expected for closed: true, Actual: " + inputFormat.closed, inputFormat.closed);
    --- End diff --
    
    The check for `inputFormat.opened` is missing, right?


> Add open and close methods to manage IF lifecycle
> -------------------------------------------------
>
>                 Key: FLINK-3777
>                 URL: https://issues.apache.org/jira/browse/FLINK-3777
>             Project: Flink
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.0.1
>            Reporter: Flavio Pompermaier
>            Assignee: Flavio Pompermaier
>              Labels: inputformat, lifecycle
>
> At the moment the opening and closing of an inputFormat are not managed, 
> although open() could be (improperly IMHO) simulated by configure().
> This limits the possibility to reuse expensive resources (like database 
> connections) and manage their release. 
> Probably the best option would be to add 2 methods (i.e. openInputformat() 
> and closeInputFormat() ) to RichInputFormat*
> * NOTE: the best option from a "semantic" point of view would be to rename 
> the current open() and close() to openSplit() and closeSplit() respectively 
> while using open() and close() methods for the IF lifecycle management, but 
> this would cause a backward compatibility issue...



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

Reply via email to