yihua commented on code in PR #13171:
URL: https://github.com/apache/hudi/pull/13171#discussion_r2053109893
##########
hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/read/TestCustomMerger.java:
##########
@@ -182,6 +180,7 @@ public void testWithThreeLogFiles(boolean
useRecordPositions) throws IOException
@Test
public void testWithFourLogFiles() throws IOException, InterruptedException {
+ shouldWritePositions = Arrays.asList(false, false, false, false, false);
Review Comment:
Should this be parameterized on `boolean useRecordPositions` as other tests
with `shouldWritePositions = Arrays.asList(useRecordPositions,
useRecordPositions, useRecordPositions, useRecordPositions,
useRecordPositions)`?
##########
hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/read/TestEventTimeMerging.java:
##########
@@ -131,73 +123,78 @@ public void initialize() throws Exception {
public void testWithOneLogFile(boolean useRecordPositions) throws
IOException, InterruptedException {
shouldWritePositions = Arrays.asList(useRecordPositions,
useRecordPositions);
// The FileSlice contains a base file and a log file.
- ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(2,
useRecordPositions);
- List<String> leftKeysExpected = Arrays.asList("6", "7", "8", "9", "10");
- List<Long> leftTimestampsExpected = Arrays.asList(2L, 2L, 2L, 2L, 2L);
- List<String> leftKeysActual = new ArrayList<>();
- List<Long> leftTimestampsActual = new ArrayList<>();
- while (iterator.hasNext()) {
- IndexedRecord record = iterator.next();
-
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
- leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ try (ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(2,
useRecordPositions)) {
+ List<String> leftKeysExpected = Arrays.asList("6", "7", "8", "9", "10");
+ List<Long> leftTimestampsExpected = Arrays.asList(2L, 2L, 2L, 2L, 2L);
+ List<String> leftKeysActual = new ArrayList<>();
+ List<Long> leftTimestampsActual = new ArrayList<>();
+ while (iterator.hasNext()) {
+ IndexedRecord record = iterator.next();
+
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
+ leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ }
+ assertEquals(leftKeysExpected, leftKeysActual);
+ assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
- assertEquals(leftKeysExpected, leftKeysActual);
- assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testWithTwoLogFiles(boolean useRecordPositions) throws
IOException, InterruptedException {
shouldWritePositions = Arrays.asList(useRecordPositions,
useRecordPositions, useRecordPositions);
// The FileSlice contains a base file and two log files.
- ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(3,
useRecordPositions);
- List<String> leftKeysExpected = Arrays.asList("6", "7", "8", "9", "10");
- List<Long> leftTimestampsExpected = Arrays.asList(2L, 2L, 2L, 2L, 2L);
- List<String> leftKeysActual = new ArrayList<>();
- List<Long> leftTimestampsActual = new ArrayList<>();
- while (iterator.hasNext()) {
- IndexedRecord record = iterator.next();
-
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
- leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ try (ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(3,
useRecordPositions)) {
+ List<String> leftKeysExpected = Arrays.asList("6", "7", "8", "9", "10");
+ List<Long> leftTimestampsExpected = Arrays.asList(2L, 2L, 2L, 2L, 2L);
+ List<String> leftKeysActual = new ArrayList<>();
+ List<Long> leftTimestampsActual = new ArrayList<>();
+ while (iterator.hasNext()) {
+ IndexedRecord record = iterator.next();
+
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
+ leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ }
+ assertEquals(leftKeysExpected, leftKeysActual);
+ assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
- assertEquals(leftKeysExpected, leftKeysActual);
- assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testWithThreeLogFiles(boolean useRecordPositions) throws
IOException, InterruptedException {
shouldWritePositions = Arrays.asList(useRecordPositions,
useRecordPositions, useRecordPositions, useRecordPositions);
// The FileSlice contains a base file and three log files.
- ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(4,
useRecordPositions);
- List<String> leftKeysExpected = Arrays.asList("6", "7", "8", "9", "10");
- List<Long> leftTimestampsExpected = Arrays.asList(2L, 2L, 2L, 2L, 2L);
- List<String> leftKeysActual = new ArrayList<>();
- List<Long> leftTimestampsActual = new ArrayList<>();
- while (iterator.hasNext()) {
- IndexedRecord record = iterator.next();
-
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
- leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ try (ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(4,
useRecordPositions)) {
+ List<String> leftKeysExpected = Arrays.asList("6", "7", "8", "9", "10");
+ List<Long> leftTimestampsExpected = Arrays.asList(2L, 2L, 2L, 2L, 2L);
+ List<String> leftKeysActual = new ArrayList<>();
+ List<Long> leftTimestampsActual = new ArrayList<>();
+ while (iterator.hasNext()) {
+ IndexedRecord record = iterator.next();
+
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
+ leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ }
+ assertEquals(leftKeysExpected, leftKeysActual);
+ assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
- assertEquals(leftKeysExpected, leftKeysActual);
- assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
@Test
public void testWithFourLogFiles() throws IOException, InterruptedException {
+ shouldWritePositions = Arrays.asList(false, false, false, false, false);
Review Comment:
Similar here on parameterizing the test
##########
hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/read/TestEventTimeMerging.java:
##########
@@ -123,6 +112,9 @@ public void initialize() throws Exception {
initMetaClient();
initTestDataGenerator(new String[]{PARTITION_PATH});
testTable = HoodieTestTable.of(metaClient);
+ // Create dedicated merger to avoid current delete logic holes.
+ // TODO: Unify delete logic (HUDI-7240).
Review Comment:
@linliu-code is this fixed?
##########
hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/read/TestOverwriteWithLatestMerger.java:
##########
@@ -126,73 +118,78 @@ public void initialize() throws Exception {
public void testWithOneLogFile(boolean useRecordPositions) throws
IOException, InterruptedException {
shouldWritePositions = Arrays.asList(useRecordPositions,
useRecordPositions);
// The FileSlice contains a base file and a log file.
- ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(2,
useRecordPositions);
- List<String> leftKeysExpected = Arrays.asList("6", "7", "8", "9", "10");
- List<Long> leftTimestampsExpected = Arrays.asList(2L, 2L, 2L, 2L, 2L);
- List<String> leftKeysActual = new ArrayList<>();
- List<Long> leftTimestampsActual = new ArrayList<>();
- while (iterator.hasNext()) {
- IndexedRecord record = iterator.next();
-
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
- leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ try (ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(2,
useRecordPositions)) {
+ List<String> leftKeysExpected = Arrays.asList("6", "7", "8", "9", "10");
+ List<Long> leftTimestampsExpected = Arrays.asList(2L, 2L, 2L, 2L, 2L);
+ List<String> leftKeysActual = new ArrayList<>();
+ List<Long> leftTimestampsActual = new ArrayList<>();
+ while (iterator.hasNext()) {
+ IndexedRecord record = iterator.next();
+
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
+ leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ }
+ assertEquals(leftKeysExpected, leftKeysActual);
+ assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
- assertEquals(leftKeysExpected, leftKeysActual);
- assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testWithTwoLogFiles(boolean useRecordPositions) throws
IOException, InterruptedException {
shouldWritePositions = Arrays.asList(useRecordPositions,
useRecordPositions, useRecordPositions);
// The FileSlice contains a base file and two log files.
- ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(3,
useRecordPositions);
- List<String> leftKeysExpected = Arrays.asList("1", "2", "3", "6", "7",
"8", "9", "10");
- List<Long> leftTimestampsExpected = Arrays.asList(1L, 1L, 1L, 2L, 2L, 2L,
2L, 2L);
- List<String> leftKeysActual = new ArrayList<>();
- List<Long> leftTimestampsActual = new ArrayList<>();
- while (iterator.hasNext()) {
- IndexedRecord record = iterator.next();
-
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
- leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ try (ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(3,
useRecordPositions)) {
+ List<String> leftKeysExpected = Arrays.asList("1", "2", "3", "6", "7",
"8", "9", "10");
+ List<Long> leftTimestampsExpected = Arrays.asList(1L, 1L, 1L, 2L, 2L,
2L, 2L, 2L);
+ List<String> leftKeysActual = new ArrayList<>();
+ List<Long> leftTimestampsActual = new ArrayList<>();
+ while (iterator.hasNext()) {
+ IndexedRecord record = iterator.next();
+
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
+ leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ }
+ assertEquals(leftKeysExpected, leftKeysActual);
+ assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
- assertEquals(leftKeysExpected, leftKeysActual);
- assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testWithThreeLogFiles(boolean useRecordPositions) throws
IOException, InterruptedException {
shouldWritePositions = Arrays.asList(useRecordPositions,
useRecordPositions, useRecordPositions, useRecordPositions);
// The FileSlice contains a base file and three log files.
- ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(4,
useRecordPositions);
- List<String> leftKeysExpected = Arrays.asList("1", "2", "3", "9", "10");
- List<Long> leftTimestampsExpected = Arrays.asList(1L, 1L, 1L, 2L, 2L);
- List<String> leftKeysActual = new ArrayList<>();
- List<Long> leftTimestampsActual = new ArrayList<>();
- while (iterator.hasNext()) {
- IndexedRecord record = iterator.next();
-
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
- leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ try (ClosableIterator<IndexedRecord> iterator = getFileGroupIterator(4,
useRecordPositions)) {
+ List<String> leftKeysExpected = Arrays.asList("1", "2", "3", "9", "10");
+ List<Long> leftTimestampsExpected = Arrays.asList(1L, 1L, 1L, 2L, 2L);
+ List<String> leftKeysActual = new ArrayList<>();
+ List<Long> leftTimestampsActual = new ArrayList<>();
+ while (iterator.hasNext()) {
+ IndexedRecord record = iterator.next();
+
leftKeysActual.add(record.get(AVRO_SCHEMA.getField(ROW_KEY).pos()).toString());
+ leftTimestampsActual.add((Long)
record.get(AVRO_SCHEMA.getField("timestamp").pos()));
+ }
+ assertEquals(leftKeysExpected, leftKeysActual);
+ assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
- assertEquals(leftKeysExpected, leftKeysActual);
- assertEquals(leftTimestampsExpected, leftTimestampsActual);
}
@Test
public void testWithFourLogFiles() throws IOException, InterruptedException {
+ shouldWritePositions = Arrays.asList(false, false, false, false, false);
Review Comment:
Same here to see if it can be parameterized without any test failures
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]