ramesh0201 commented on code in PR #3264:
URL: https://github.com/apache/hive/pull/3264#discussion_r868331618


##########
common/src/java/org/apache/hadoop/hive/common/FileUtils.java:
##########
@@ -408,10 +408,23 @@ public static FileStatus 
getPathOrParentThatExists(FileSystem fs, Path path) thr
     return getPathOrParentThatExists(fs, parentPath);
   }
 
-  public static void checkFileAccessWithImpersonation(final FileSystem fs, 
final FileStatus stat,
-      final FsAction action, final String user)
-      throws IOException, AccessControlException, InterruptedException, 
Exception {
-    checkFileAccessWithImpersonation(fs, stat, action, user, null);
+  public static void checkFileAccessWithImpersonation(final FileSystem fs, 
final FileStatus stat, final FsAction action,
+      final String user) throws IOException, AccessControlException, 
InterruptedException, Exception {
+    UserGroupInformation ugi = Utils.getUGI();
+    String currentUser = ugi.getShortUserName();
+    UserGroupInformation proxyUser = null;
+    FileSystem fsAsUser = null;
+    try {
+      if (user != null && !user.equals(currentUser)) {
+        proxyUser = UserGroupInformation.createProxyUser(user, 
UserGroupInformation.getLoginUser());
+        fsAsUser = FileUtils.getFsAsUser(fs, proxyUser);
+      }
+      checkFileAccessWithImpersonation(fs, stat, action, user, null, fsAsUser);

Review Comment:
   Yes I looked at that. But right now we can see that the FIleSystem.get() 
(either from cache or new init object) takes few ms for each file accumulating 
few seconds if the number of files is too many. We would like to completely get 
rid of the FS.get() calls inside a recursive path -- unless it is necessary



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to