Correct clean bug that causes clean failure when partitionPaths are empty
This commit is contained in:
committed by
prazanna
parent
7ef76a4de0
commit
3aa8083913
@@ -1225,6 +1225,28 @@ public class TestHoodieClient implements Serializable {
|
||||
assertTrue(HoodieTestUtils.doesDataFileExist(basePath, partitionPaths[0], "001", file2P0C1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCleaningWithZeroPartitonPaths() throws IOException {
|
||||
HoodieWriteConfig config = HoodieWriteConfig.newBuilder().withPath(basePath)
|
||||
.withAssumeDatePartitioning(true)
|
||||
.withCompactionConfig(HoodieCompactionConfig.newBuilder()
|
||||
.withCleanerPolicy(HoodieCleaningPolicy.KEEP_LATEST_COMMITS)
|
||||
.retainCommits(2).build()).build();
|
||||
|
||||
// Make a commit, although there are no partitionPaths.
|
||||
// Example use-case of this is when a client wants to create a table
|
||||
// with just some commit metadata, but no data/partitionPaths.
|
||||
HoodieTestUtils.createCommitFiles(basePath, "000");
|
||||
|
||||
HoodieTable table = HoodieTable
|
||||
.getHoodieTable(new HoodieTableMetaClient(FSUtils.getFs(), config.getBasePath(), true),
|
||||
config);
|
||||
|
||||
List<HoodieCleanStat> hoodieCleanStatsOne = table.clean(jsc);
|
||||
assertTrue("HoodieCleanStats should be empty for a table with empty partitionPaths",
|
||||
hoodieCleanStatsOne.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCleaningSkewedPartitons() throws IOException {
|
||||
HoodieWriteConfig config = HoodieWriteConfig.newBuilder().withPath(basePath)
|
||||
|
||||
Reference in New Issue
Block a user