You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by zentol <gi...@git.apache.org> on 2018/02/13 13:05:09 UTC

[GitHub] flink pull request #5415: [FLINK-3655] [core] Support multiple paths in File...

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

    https://github.com/apache/flink/pull/5415#discussion_r167850694
  
    --- Diff: flink-core/src/test/java/org/apache/flink/api/common/io/DelimitedInputFormatTest.java ---
    @@ -428,6 +431,78 @@ public void testDelimiterOnBufferBoundary() throws IOException {
     		format.close();
     	}
     
    +	// -- Statistics --//
    +
    +	@Test
    +	public void testGetStatistics() throws IOException {
    +		final String myString = "my mocked line 1\nmy mocked line 2\n";
    +		final long size = myString.length();
    +		final Path filePath = createTempFilePath(myString);
    +
    +		final String myString2 = "my mocked line 1\nmy mocked line 2\nanother mocked line3\n";
    +		final long size2 = myString2.length();
    +		final Path filePath2 = createTempFilePath(myString2);
    +
    +		final long totalSize = size + size2;
    +
    +		DelimitedInputFormat<String> format = new MyTextInputFormat();
    +		format.setFilePaths(filePath.toUri().toString(), filePath2.toUri().toString());
    +
    +		FileInputFormat.FileBaseStatistics stats = format.getStatistics(null);
    +		assertNotNull(stats);
    +		assertEquals("The file size from the statistics is wrong.", totalSize, stats.getTotalInputSize());
    +	}
    +	
    +	@Test
    +	public void testGetStatisticsFileDoesNotExist() throws IOException {
    +		DelimitedInputFormat<String> format = new MyTextInputFormat();
    +		format.setFilePaths("file:///path/does/not/really/exist", "file:///another/path/that/does/not/exist");
    +
    +		FileBaseStatistics stats = format.getStatistics(null);
    +		assertNull("The file statistics should be null.", stats);
    +	}
    +
    +	@Test
    +	public void testGetStatisticsSingleFileWithCachedVersion() throws IOException {
    +		final String myString = "my mocked line 1\nmy mocked line 2\n";
    +		final Path tempFile = createTempFilePath(myString);
    +		final long size = myString.length();
    +		final long cachedSize = 10065;
    --- End diff --
    
    can we rename this to `fakeSize`?


---