Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/1032#discussion_r150685414 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java --- @@ -150,14 +152,30 @@ public WorkspaceSchemaFactory( * @return True if the user has access. False otherwise. */ public boolean accessible(final String userName) throws IOException { - final FileSystem fs = ImpersonationUtil.createFileSystem(userName, fsConf); + final DrillFileSystem fs = ImpersonationUtil.createFileSystem(userName, fsConf); + return accessible(fs); + } + + /** + * Checks whether a FileSystem object has the permission to list/read workspace directory + * @param fs a DrillFileSystem object that was created with certain user privilege + * @return True if the user has access. False otherwise. + * @throws IOException + */ + public boolean accessible(DrillFileSystem fs) throws IOException { try { - // We have to rely on the listStatus as a FileSystem can have complicated controls such as regular unix style - // permissions, Access Control Lists (ACLs) or Access Control Expressions (ACE). Hadoop 2.7 version of FileSystem - // has a limited private API (FileSystem.access) to check the permissions directly - // (see https://issues.apache.org/jira/browse/HDFS-6570). Drill currently relies on Hadoop 2.5.0 version of - // FileClient. TODO: Update this when DRILL-3749 is fixed. - fs.listStatus(wsPath); + /** + * For Windows local file system, fs.access ends up using DeprecatedRawLocalFileStatus which has + * TrustedInstaller as owner, and a member of Administrators group could not satisfy the permission. + * In this case, we will still use method listStatus. + * In other cases, we use access method since it is cheaper. + */ + if (SystemUtils.IS_OS_WINDOWS && fs.getUri().getScheme().equalsIgnoreCase("file")) { --- End diff -- HDFS probably defines a constant for "file". Should we reference that?
---