Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct clean bug that causes exception when partitionPaths are empty #202

Merged
merged 1 commit into from
Jun 20, 2017

Conversation

kaushikd49
Copy link
Contributor

@kaushikd49 kaushikd49 commented Jun 20, 2017

This fixes #200

Corrected logic and added a test to detect the bug.

Copy link
Contributor

@prazanna prazanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also create a github issue and assign it to yourself? Thanks.

Update: Noticed the issue exists already and added the comment to link this PR to the issue

try {
List<String> partitionsToClean =
FSUtils.getAllPartitionPaths(getFs(), getMetaClient().getBasePath(), config.shouldAssumeDatePartitioning());
logger.info("Partitions to clean up : " + partitionsToClean + ", with policy " + config
.getCleanerPolicy());
partitionCleanStats = cleanPartitionPaths(partitionsToClean, jsc);
if (partitionsToClean.isEmpty()) {
logger.info("Nothing to clean here mom. It is already clean");
return partitionCleanStats;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return Lists.newArrayList()

@@ -492,17 +492,17 @@ protected HoodieUpdateHandle getUpdateHandle(String commitTime, String fileLoc,
*/
@Override
public List<HoodieCleanStat> clean(JavaSparkContext jsc) {
List<HoodieCleanStat> partitionCleanStats;
List<HoodieCleanStat> partitionCleanStats = Collections.emptyList();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this and return empty list when there is nothing to clean

if (partitionsToClean.isEmpty()) {
logger.info("Nothing to clean here mom. It is already clean");
return partitionCleanStats;
}
partitionCleanStats = cleanPartitionPaths(partitionsToClean, jsc);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return this directly

@kaushikd49
Copy link
Contributor Author

Updated the PR Prasanna.

@prazanna prazanna merged commit 3aa8083 into apache:master Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hoodie commit fails if number of partitions to be cleaned are 0.
2 participants