Skip to content

Commit

Permalink
Merge pull request #6 from PickBas/fix-8810-delta-lake
Browse files Browse the repository at this point in the history
[ISSUE #8810] delta-lake/*: replaced .size() > 0 with isEmpty()
  • Loading branch information
PickBas authored Oct 13, 2023
2 parents c0ed11e + 59dccae commit 54cb4fc
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,18 @@ private void commitDeltaVersionLogToIcebergTransaction(
migratedDataFilesBuilder.add(dataFile.path().toString());
}

if (filesToAdd.size() > 0 && filesToRemove.size() > 0) {
if (!filesToAdd.isEmpty() && !filesToRemove.isEmpty()) {
// OverwriteFiles case
OverwriteFiles overwriteFiles = transaction.newOverwrite();
filesToAdd.forEach(overwriteFiles::addFile);
filesToRemove.forEach(overwriteFiles::deleteFile);
overwriteFiles.commit();
} else if (filesToAdd.size() > 0) {
} else if (!filesToAdd.isEmpty()) {
// AppendFiles case
AppendFiles appendFiles = transaction.newAppend();
filesToAdd.forEach(appendFiles::appendFile);
appendFiles.commit();
} else if (filesToRemove.size() > 0) {
} else if (!filesToRemove.isEmpty()) {
// DeleteFiles case
DeleteFiles deleteFiles = transaction.newDelete();
filesToRemove.forEach(deleteFiles::deleteFile);
Expand Down

0 comments on commit 54cb4fc

Please sign in to comment.