[HUDI-400] Check upgrade from old plan to new plan for compaction (#1422)
* Fix NPE when DataFile is null * Check from old plan upgrade to new plan
This commit is contained in:
@@ -55,7 +55,7 @@ public class CompactionV2MigrationHandler extends AbstractMigratorBase<HoodieCom
|
||||
v2CompactionOperationList = input.getOperations().stream().map(inp ->
|
||||
HoodieCompactionOperation.newBuilder().setBaseInstantTime(inp.getBaseInstantTime())
|
||||
.setFileId(inp.getFileId()).setPartitionPath(inp.getPartitionPath()).setMetrics(inp.getMetrics())
|
||||
.setDataFilePath(new Path(inp.getDataFilePath()).getName()).setDeltaFilePaths(
|
||||
.setDataFilePath(inp.getDataFilePath() == null ? null : new Path(inp.getDataFilePath()).getName()).setDeltaFilePaths(
|
||||
inp.getDeltaFilePaths().stream().map(s -> new Path(s).getName()).collect(Collectors.toList()))
|
||||
.build()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -84,6 +84,8 @@ public class TestCompactionUtils extends HoodieCommonTestHarness {
|
||||
HoodieCompactionPlan newPlan = migrator.upgradeToLatest(plan, plan.getVersion());
|
||||
Assert.assertEquals(LATEST_COMPACTION_METADATA_VERSION, newPlan.getVersion());
|
||||
testFileSlicesCompactionPlanEquality(inputAndPlan.getKey(), newPlan);
|
||||
HoodieCompactionPlan latestPlan = migrator.migrateToVersion(oldPlan, oldPlan.getVersion(), newPlan.getVersion());
|
||||
testFileSlicesCompactionPlanEquality(inputAndPlan.getKey(), latestPlan);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user