.../org/apache/hadoop/hive/ql/exec/Utilities.java | 24 +++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java index ebf1344..6549835 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java @@ -2369,16 +2369,30 @@ public static boolean isEmptyPath(JobConf job, Path dirPath, Context ctx) } public static boolean isEmptyPath(Configuration job, Path dirPath) throws IOException { + boolean isEmptyPath = false; FileSystem inpFs = dirPath.getFileSystem(job); try { - FileStatus[] fStats = inpFs.listStatus(dirPath, FileUtils.HIDDEN_FILES_PATH_FILTER); - if (fStats.length > 0) { - return false; + FileStatus[] fStats = inpFs.listStatus(dirPath, new PathFilter() { + boolean hasFile = false; + + @Override + public boolean accept(Path path) + { + if (hasFile) { + return false; + } + hasFile = FileUtils.HIDDEN_FILES_PATH_FILTER.accept(path); + return hasFile; + } + }); + + if (fStats.length == 0) { + isEmptyPath = true; } } catch(FileNotFoundException fnf) { - return true; + isEmptyPath = true; } - return true; + return isEmptyPath; } public static List getTezTasks(List> tasks) {