zhijiangW commented on a change in pull request #10573: [FLINK-13589] Fixing
DelimitedInputFormat for whole file input splits.
URL: https://github.com/apache/flink/pull/10573#discussion_r358103098
##########
File path:
flink-core/src/test/java/org/apache/flink/api/common/io/DelimitedInputFormatTest.java
##########
@@ -431,6 +431,34 @@ public void testDelimiterOnBufferBoundary() throws
IOException {
format.close();
}
+ @Test
+ public void testDelimiterOnBufferBoundaryWithWholeFileSplit() throws
IOException {
+
+ String[] records = new
String[]{"1234567890<DEL?NO!>1234567890", "1234567890<DEL?NO!>1234567890",
"<DEL?NO!>"};
+ String delimiter = "<DELIM>";
+ String fileContent = StringUtils.join(records, delimiter);
+
+
+ final FileInputSplit split = createTempFile(fileContent);
+ final FileInputSplit fullSplit = new FileInputSplit(0,
split.getPath(), 0, -1, split.getHostnames());
+ final Configuration parameters = new Configuration();
+
+ format.setBufferSize(12);
+ format.setDelimiter(delimiter);
+ format.configure(parameters);
+ format.open(fullSplit);
+
+ for (String record : records) {
+ String value = format.nextRecord(null);
+ assertEquals(record, value);
+ }
+
+ assertNull(format.nextRecord(null));
+ assertTrue(format.reachedEnd());
+
+ format.close();
Review comment:
nit: this is reductant because it would be handled in `@After`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services