[
https://issues.apache.org/jira/browse/FLINK-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16362279#comment-16362279
]
ASF GitHub Bot commented on FLINK-3655:
---------------------------------------
Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/5415#discussion_r167853159
--- Diff:
flink-core/src/test/java/org/apache/flink/api/common/io/FileInputFormatTest.java
---
@@ -203,7 +390,104 @@ public void
testGetStatisticsMultipleFilesWithCachedVersion() {
Assert.fail(ex.getMessage());
}
}
-
+
+ // -- Multiple Files -- //
+
+ @Test
+ public void testGetStatisticsMultipleNonExistingFile() throws
IOException {
+ final MultiDummyFileInputFormat format = new
MultiDummyFileInputFormat();
+
format.setFilePaths("file:///some/none/existing/directory/","file:///another/non/existing/directory/");
+ format.configure(new Configuration());
+
+ BaseStatistics stats = format.getStatistics(null);
+ Assert.assertNull("The file statistics should be null.", stats);
+ }
+
+ @Test
+ public void testGetStatisticsMultipleOneFileNoCachedVersion() throws
IOException {
+ final long size1 = 1024 * 500;
+ String tempFile = TestFileUtils.createTempFile(size1);
+
+ final long size2 = 1024 * 505;
+ String tempFile2 = TestFileUtils.createTempFile(size2);
+
+ final long totalSize = size1 + size2;
+
+ final MultiDummyFileInputFormat format = new
MultiDummyFileInputFormat();
+ format.setFilePaths(tempFile, tempFile2);
+ format.configure(new Configuration());
+
+ BaseStatistics stats = format.getStatistics(null);
+ Assert.assertEquals("The file size from the statistics is
wrong.", totalSize, stats.getTotalInputSize());
+ }
+
+ @Test
+ public void
testGetStatisticsMultipleFilesMultiplePathsNoCachedVersion() throws IOException
{
+ final long size1 = 2077;
+ final long size2 = 31909;
+ final long size3 = 10;
+ final long totalSize123 = size1 + size2 + size3;
+
+ String tempDir = TestFileUtils.createTempFileDir(size1, size2,
size3);
+
+ final long size4 = 2051;
+ final long size5 = 31902;
+ final long size6 = 15;
+ final long totalSize456 = size4 + size5 + size6;
+ String tempDir2 = TestFileUtils.createTempFileDir(size4, size5,
size6);
+
+ final MultiDummyFileInputFormat format = new
MultiDummyFileInputFormat();
+ format.setFilePaths(tempDir, tempDir2);
+ format.configure(new Configuration());
+
+ BaseStatistics stats = format.getStatistics(null);
+ Assert.assertEquals("The file size from the statistics is
wrong.", totalSize123 + totalSize456, stats.getTotalInputSize());
+ }
+
+ @Test
+ public void testGetStatisticsMultipleOneFileWithCachedVersion() throws
IOException {
+ final long size1 = 50873;
+ final long cachedSize = 10065;
--- End diff --
rename to `fakeSize`
> Allow comma-separated or multiple directories to be specified for
> FileInputFormat
> ---------------------------------------------------------------------------------
>
> Key: FLINK-3655
> URL: https://issues.apache.org/jira/browse/FLINK-3655
> Project: Flink
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.0.0
> Reporter: Gna Phetsarath
> Assignee: Fabian Hueske
> Priority: Major
> Labels: starter
> Fix For: 1.5.0
>
>
> Allow comma-separated or multiple directories to be specified for
> FileInputFormat so that a DataSource will process the directories
> sequentially.
>
> env.readFile("/data/2016/01/01/*/*,/data/2016/01/02/*/*,/data/2016/01/03/*/*")
> in Scala
> env.readFile(paths: Seq[String])
> or
> env.readFile(path: String, otherPaths: String*)
> Wildcard support would be a bonus.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)