diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java index 6de0a285a84..9aebbb5a22e 100644 --- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java +++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java @@ -84,6 +84,7 @@ @InterfaceStability.Stable public class NativeAzureFileSystem extends FileSystem { private static final int USER_WX_PERMISION = 0300; + private static final String USER_HOME_DIR_PREFIX_DEFAULT = "/user"; /** * A description of a folder rename operation, including the source and * destination keys, and descriptions of the files in the source folder. @@ -1129,6 +1130,8 @@ private void restoreKey() throws IOException { */ private WasbAuthorizerInterface authorizer = null; + private UserGroupInformation ugi; + private String delegationToken = null; public NativeAzureFileSystem() { @@ -1247,6 +1250,7 @@ public void initialize(URI uri, Configuration conf) store.initialize(uri, conf, instrumentation); setConf(conf); + this.ugi = UserGroupInformation.getCurrentUser(); this.uri = URI.create(uri.getScheme() + "://" + uri.getAuthority()); this.workingDir = new Path("/user", UserGroupInformation.getCurrentUser() .getShortUserName()).makeQualified(getUri(), getWorkingDirectory()); @@ -1276,6 +1280,12 @@ public void initialize(URI uri, Configuration conf) } } + @Override + public Path getHomeDirectory() { + return makeQualified(new Path( + USER_HOME_DIR_PREFIX_DEFAULT + "/" + this.ugi.getShortUserName())); + } + @VisibleForTesting public void updateWasbAuthorizer(WasbAuthorizerInterface authorizer) { this.authorizer = authorizer;