// Create filesystem for the given user and given path
// TODO: DX-16001 - make async configurable for Hive.
private boolean checkAccessPermission() throws IOException {
      final JobConf jobConf = new JobConf(hiveConf);
      Preconditions.checkArgument(updateKey.getCachedEntitiesCount() > 0, "hive partition update key should contain at least one path");
      for (FileSystemCachedEntity cachedEntity : updateKey.getCachedEntitiesList()) {
        final Path cachedEntityPath;
        if (cachedEntity.getPath() == null || cachedEntity.getPath().isEmpty()) {
          cachedEntityPath = new Path(updateKey.getPartitionRootDir());
        } else {
          cachedEntityPath = new Path(updateKey.getPartitionRootDir(), cachedEntity.getPath());
        }
        // Create filesystem for the given user and given path
        // TODO: DX-16001 - make async configurable for Hive.
        final HadoopFileSystemWrapper userFS = HiveImpersonationUtil.createFileSystem(user, jobConf, cachedEntityPath);
        try {
          if (cachedEntity.getIsDir()) {
            //DX-7850 : remove once solution for maprfs is found
            if (userFS.isMapRfs()) {
              userFS.access(cachedEntityPath, FsAction.READ);
            } else {
              userFS.access(cachedEntityPath, FsAction.READ_EXECUTE);
            }
          } else {
            userFS.access(cachedEntityPath, FsAction.READ);
          }
        } catch (AccessControlException ace) {
          return false;
        }
      }
      return true;
    }
cachedEntityPath = new Path(updateKey.getPartitionRootDir(), cachedEntity.getPath());
}
// Create filesystem for the given user and given path
// TODO: DX-16001 - make async configurable for Hive.
final HadoopFileSystemWrapper userFS = HiveImpersonationUtil.createFileSystem(user, jobConf, cachedEntityPath);
try {
private boolean checkAccessPermission() throws IOException {
final JobConf jobConf = new JobConf(hiveConf);
Preconditions.checkArgument(updateKey.getCachedEntitiesCount() > 0, "hive partition update key should contain at least one path");
for (FileSystemCachedEntity cachedEntity : updateKey.getCachedEntitiesList()) {
final Path cachedEntityPath;
if (cachedEntity.getPath() == null || cachedEntity.getPath().isEmpty()) {
cachedEntityPath = new Path(updateKey.getPartitionRootDir());
} else {
cachedEntityPath = new Path(updateKey.getPartitionRootDir(), cachedEntity.getPath());
}
// Create filesystem for the given user and given path
// TODO: DX-16001 - make async configurable for Hive.
final HadoopFileSystemWrapper userFS = HiveImpersonationUtil.createFileSystem(user, jobConf, cachedEntityPath);
try {
if (cachedEntity.getIsDir()) {
//DX-7850 : remove once solution for maprfs is found
if (userFS.isMapRfs()) {
userFS.access(cachedEntityPath, FsAction.READ);
} else {
userFS.access(cachedEntityPath, FsAction.READ_EXECUTE);
}
} else {
private boolean checkAccessPermission() throws IOException {
final JobConf jobConf = new JobConf(hiveConf);
Preconditions.checkArgument(updateKey.getCachedEntitiesCount() > 0, "hive partition update key should contain at least one path");
for (FileSystemCachedEntity cachedEntity : updateKey.getCachedEntitiesList()) {
final Path cachedEntityPath;
if (cachedEntity.getPath() == null || cachedEntity.getPath().isEmpty()) {
cachedEntityPath = new Path(updateKey.getPartitionRootDir());
} else {
cachedEntityPath = new Path(updateKey.getPartitionRootDir(), cachedEntity.getPath());
}
// Create filesystem for the given user and given path
// TODO: DX-16001 - make async configurable for Hive.
final HadoopFileSystemWrapper userFS = HiveImpersonationUtil.createFileSystem(user, jobConf, cachedEntityPath);
try {
if (cachedEntity.getIsDir()) {
//DX-7850 : remove once solution for maprfs is found
if (userFS.isMapRfs()) {
userFS.access(cachedEntityPath, FsAction.READ);
} else {
userFS.access(cachedEntityPath, FsAction.READ_EXECUTE);
}
} else {
userFS.access(cachedEntityPath, FsAction.READ);
}
} catch (AccessControlException ace) {
return false;
}
}
return true;
}