diff --git a/fe/fe-core/src/main/java/org/apache/doris/fs/remote/dfs/DFSFileSystem.java b/fe/fe-core/src/main/java/org/apache/doris/fs/remote/dfs/DFSFileSystem.java index fca264126cfc08..25ecafda46875e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/fs/remote/dfs/DFSFileSystem.java +++ b/fe/fe-core/src/main/java/org/apache/doris/fs/remote/dfs/DFSFileSystem.java @@ -146,6 +146,16 @@ private UserGroupInformation doLogin(Configuration conf) throws UserException { hadoopUserName = "hadoop"; LOG.debug(HdfsResource.HADOOP_USER_NAME + " is unset, use default user: hadoop"); } + + try { + UserGroupInformation ugi = UserGroupInformation.getLoginUser(); + if (ugi.getUserName().equals(hadoopUserName)) { + return ugi; + } + } catch (IOException e) { + LOG.warn("A SecurityException occurs with simple, do login immediately.", e); + } + UserGroupInformation ugi = UserGroupInformation.createRemoteUser(hadoopUserName); UserGroupInformation.setLoginUser(ugi); LOG.info("Login by proxy user, hadoop.username: {}", hadoopUserName);