sunithabeeram commented on a change in pull request #3834: Unify move method in
PinotFS
URL: https://github.com/apache/incubator-pinot/pull/3834#discussion_r258149466
##########
File path:
pinot-azure-filesystem/src/main/java/org/apache/pinot/filesystem/AzurePinotFS.java
##########
@@ -100,9 +100,28 @@ public boolean delete(URI segmentUri, boolean forceDelete)
@Override
public boolean move(URI srcUri, URI dstUri, boolean overwrite)
throws IOException {
- if (exists(dstUri) && !overwrite) {
+ if (!exists(srcUri)) {
+ LOGGER.warn("Source {} does not exist", srcUri);
return false;
}
+ // if dst is an existing file
+ if (exists(dstUri) && !isDirectory(dstUri)) {
+ if (isDirectory(srcUri)) {
+ String errorMsg = String.format("Source %s is a directory while
destination %s is a file", srcUri, dstUri);
+ LOGGER.warn(errorMsg);
+ throw new IOException(errorMsg);
+ } else {
+ if (overwrite) {
+ delete(dstUri, true);
+ } else {
+ // dst file exists, returning
+ return false;
+ }
+ }
+ }
+ // ensures the parent path of dst exists.
+ URI parentUri = Paths.get(dstUri).toUri();
+ _adlStoreClient.createDirectory(parentUri.getPath());
//rename the file
Review comment:
This comment is misleading as its assuming a 'file' whereas all of the above
code seems more flexible.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]