You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@parquet.apache.org by ju...@apache.org on 2017/05/17 00:19:11 UTC

parquet-mr git commit: PARQUET-990 More detailed error messages in footer parsing

Repository: parquet-mr
Updated Branches:
  refs/heads/master 1de41ef4b -> 9491d7a61


PARQUET-990 More detailed error messages in footer parsing

Include invalid values in exception messages when reading footer for two situations:

- too-short files (include file length)
- files with corrupted footer lengths (include calculated footer start index)

Author: Andrew Ash <an...@andrewash.com>

Closes #408 from ash211/patch-1 and squashes the following commits:

74f5836 [Andrew Ash] More detailed error messages in footer parsing


Project: http://git-wip-us.apache.org/repos/asf/parquet-mr/repo
Commit: http://git-wip-us.apache.org/repos/asf/parquet-mr/commit/9491d7a6
Tree: http://git-wip-us.apache.org/repos/asf/parquet-mr/tree/9491d7a6
Diff: http://git-wip-us.apache.org/repos/asf/parquet-mr/diff/9491d7a6

Branch: refs/heads/master
Commit: 9491d7a61681f7acc7103a6d1d45efe96f7981d2
Parents: 1de41ef
Author: Andrew Ash <an...@andrewash.com>
Authored: Tue May 16 17:19:06 2017 -0700
Committer: Julien Le Dem <ju...@apache.org>
Committed: Tue May 16 17:19:06 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/parquet/hadoop/ParquetFileReader.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/parquet-mr/blob/9491d7a6/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
----------------------------------------------------------------------
diff --git a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
index 7b7534c..1815bd6 100644
--- a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
+++ b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
@@ -471,7 +471,7 @@ public class ParquetFileReader implements Closeable {
     LOG.debug("File length {}", fileLen);
     int FOOTER_LENGTH_SIZE = 4;
     if (fileLen < MAGIC.length + FOOTER_LENGTH_SIZE + MAGIC.length) { // MAGIC + data + footer + footerIndex + MAGIC
-      throw new RuntimeException(filePath + " is not a Parquet file (too small)");
+      throw new RuntimeException(filePath + " is not a Parquet file (too small length: " + fileLen + ")");
     }
     long footerLengthIndex = fileLen - FOOTER_LENGTH_SIZE - MAGIC.length;
     LOG.debug("reading footer index at {}", footerLengthIndex);
@@ -486,7 +486,7 @@ public class ParquetFileReader implements Closeable {
     long footerIndex = footerLengthIndex - footerLength;
     LOG.debug("read footer length: {}, footer index: {}", footerLength, footerIndex);
     if (footerIndex < MAGIC.length || footerIndex >= footerLengthIndex) {
-      throw new RuntimeException("corrupted file: the footer index is not within the file");
+      throw new RuntimeException("corrupted file: the footer index is not within the file: " + footerIndex);
     }
     f.seek(footerIndex);
     return converter.readParquetMetadata(f, filter);