Source:
public boolean rename(final Path src, final Path dst) throws IOException { LOG.debug("AzureBlobFileSystem.rename src: dst: {}", src, dst); statIncrement(CALL_RENAME); trailingPeriodCheck(dst); Path parentFolder = src.getParent(); if (parentFolder == null) { return false; } Path qualifiedSrcPath = makeQualified(src); Path qualifiedDstPath = makeQualified(dst); if(makeQualified(parentFolder).equals(qualifiedDstPath)) { return tryGetFileStatus(qualifiedSrcPath) != null; } FileStatus dstFileStatus = null; if (qualifiedSrcPath.equals(qualifiedDstPath)) { dstFileStatus = tryGetFileStatus(qualifiedDstPath); if (dstFileStatus == null) { return false; } return dstFileStatus.isDirectory() ? false : true; } if (!abfsStore.getIsNamespaceEnabled() && dstFileStatus == null) { dstFileStatus = tryGetFileStatus(qualifiedDstPath); } try { String sourceFileName = src.getName(); Path adjustedDst = dst; if (dstFileStatus != null) { if (!dstFileStatus.isDirectory()) { return qualifiedSrcPath.equals(qualifiedDstPath); } adjustedDst = new Path(dst, sourceFileName); } qualifiedDstPath = makeQualified(adjustedDst); abfsStore.rename(qualifiedSrcPath, qualifiedDstPath); return true; } catch(AzureBlobFileSystemException ex) { LOG.debug("Rename operation failed", ex); checkException( src, ex, AzureServiceErrorCode.PATH_ALREADY_EXISTS, AzureServiceErrorCode.INVALID_RENAME_SOURCE_PATH, AzureServiceErrorCode.SOURCE_PATH_NOT_FOUND, AzureServiceErrorCode.INVALID_SOURCE_OR_DESTINATION_RESOURCE_TYPE, AzureServiceErrorCode.RENAME_DESTINATION_PARENT_PATH_NOT_FOUND, AzureServiceErrorCode.INTERNAL_OPERATION_ABORT); return false; } }

Target:
public boolean rename(final Path src, final Path dst) throws IOException { LOG.debug("AzureBlobFileSystem.rename src: dst: {}", src, dst); statIncrement(CALL_RENAME); trailingPeriodCheck(dst); Path parentFolder = src.getParent(); if (parentFolder == null) { return false; } Path qualifiedSrcPath = makeQualified(src); Path qualifiedDstPath = makeQualified(dst); if(makeQualified(parentFolder).equals(qualifiedDstPath)) { return tryGetFileStatus(qualifiedSrcPath) != null; } FileStatus dstFileStatus = null; if (qualifiedSrcPath.equals(qualifiedDstPath)) { dstFileStatus = tryGetFileStatus(qualifiedDstPath); if (dstFileStatus == null) { return false; } return dstFileStatus.isDirectory() ? false : true; } if (!abfsStore.getIsNamespaceEnabled() && dstFileStatus == null) { dstFileStatus = tryGetFileStatus(qualifiedDstPath); } try { String sourceFileName = src.getName(); Path adjustedDst = dst; if (dstFileStatus != null) { if (!dstFileStatus.isDirectory()) { return qualifiedSrcPath.equals(qualifiedDstPath); } adjustedDst = new Path(dst, sourceFileName); } qualifiedDstPath = makeQualified(adjustedDst); abfsStore.rename(qualifiedSrcPath, qualifiedDstPath); return true; } catch(AzureBlobFileSystemException ex) { LOG.debug("Rename operation failed. ", ex); checkException( src, ex, AzureServiceErrorCode.PATH_ALREADY_EXISTS, AzureServiceErrorCode.INVALID_RENAME_SOURCE_PATH, AzureServiceErrorCode.SOURCE_PATH_NOT_FOUND, AzureServiceErrorCode.INVALID_SOURCE_OR_DESTINATION_RESOURCE_TYPE, AzureServiceErrorCode.RENAME_DESTINATION_PARENT_PATH_NOT_FOUND, AzureServiceErrorCode.INTERNAL_OPERATION_ABORT); return false; } }