diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java index bf332bc0b84..10a780cb5b7 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java @@ -2171,15 +2171,15 @@ public static long getLogicalLength(FileSystem fs, FileStatus file) throws IOExc else { return file.getLen(); } - Path lengths = OrcAcidUtils.getSideFile(file.getPath()); - if(!fs.exists(lengths)) { - /** - * if here for delta_x_y that means txn y is resolved and all files in this delta are closed so - * they should all have a valid ORC footer and info from NameNode about length is good + long len = OrcAcidUtils.getLastFlushLength(fs, file.getPath()); + if (len == Long.MAX_VALUE) { + /* + * File doesn't exist. if here for delta_x_y that means txn y is resolved and all files in + * this delta are closed so they should all have a valid ORC footer and info from NameNode + * about length is good */ return file.getLen(); } - long len = OrcAcidUtils.getLastFlushLength(fs, file.getPath()); if(len >= 0) { /** * if here something is still writing to delta_x_y so read only as far as the last commit, @@ -2194,7 +2194,8 @@ public static long getLogicalLength(FileSystem fs, FileStatus file) throws IOExc * means some committed data from 'file' would be skipped. * This should be very unusual. */ - throw new IOException(lengths + " found but is not readable. Consider waiting or orcfiledump --recover"); + throw new IOException(OrcAcidUtils.getSideFile(file.getPath()) + " found but is not readable." + + " Consider waiting or orcfiledump --recover"); }