Skip to content

Commit

Permalink
Differentiate failures in asyncRename
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Jan 11, 2022
1 parent f722686 commit 598c392
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2518,8 +2518,11 @@ private static void asyncRename(
return;
}
try {
if (fileSystem.exists(target) || !fileSystem.rename(source, target)) {
throw new TrinoException(HIVE_FILESYSTEM_ERROR, format("Error moving data files from %s to final location %s", source, target));
if (fileSystem.exists(target)) {
throw new TrinoException(HIVE_FILESYSTEM_ERROR, format("Error moving data files from %s to final location %s: target location already exists", source, target));
}
if (!fileSystem.rename(source, target)) {
throw new TrinoException(HIVE_FILESYSTEM_ERROR, format("Error moving data files from %s to final location %s: rename not successful", source, target));
}
}
catch (IOException e) {
Expand Down

0 comments on commit 598c392

Please sign in to comment.