You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/06/14 04:23:36 UTC
[GitHub] [flink] reswqa commented on a diff in pull request #19946: [FLINK-28018][core] correct the start index for creating empty splits in BinaryInputFormat#createInputSplits
reswqa commented on code in PR #19946:
URL: https://github.com/apache/flink/pull/19946#discussion_r896360739
##########
flink-core/src/test/java/org/apache/flink/api/common/io/BinaryInputFormatTest.java:
##########
@@ -160,11 +161,45 @@ public void testGetStatisticsMultiplePaths() throws IOException {
stats.getTotalInputSize());
}
+ @Test
+ public void testCreateInputSplitsWithEmptySplit() throws IOException {
+ final int blockInfoSize = new BlockInfo().getInfoSize();
+ final int blockSize = blockInfoSize + 8;
+ final int numBlocks = 3;
+ final int minNumSplits = 5;
+
+ // create temporary file with 3 blocks
+ final File tempFile =
+ createBinaryInputFile(
+ "test_create_input_splits_with_empty_split", blockSize, numBlocks);
+
+ final Configuration config = new Configuration();
+ config.setLong("input.block_size", blockSize + 10);
+
+ final BinaryInputFormat<Record> inputFormat = new MyBinaryInputFormat();
+ inputFormat.setFilePath(tempFile.toURI().toString());
+ inputFormat.setBlockSize(blockSize);
+
+ inputFormat.configure(config);
+
+ FileInputSplit[] inputSplits = inputFormat.createInputSplits(minNumSplits);
+
+ Assert.assertEquals(
Review Comment:
Are you willing to use assertj instead of junit.Assert,so that subsequent migration to junit5 will be more convenient.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org