This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-mr.git


The following commit(s) were added to refs/heads/master by this push:
     new 2122a8a  PARQUET-1683: Remove unnecessary string conversions (#695)
2122a8a is described below

commit 2122a8a8e0fcc08307a5e1926b234bcfe3286ec1
Author: shangxinli <[email protected]>
AuthorDate: Tue Oct 22 22:33:33 2019 -0700

    PARQUET-1683: Remove unnecessary string conversions (#695)
    
    Remove unnecessary string converting
    in readFooter method.
---
 .../src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java   | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

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 e71331f..366c429 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
@@ -515,11 +515,10 @@ public class ParquetFileReader implements Closeable {
 
   private static final ParquetMetadata readFooter(InputFile file, 
ParquetReadOptions options, SeekableInputStream f, ParquetMetadataConverter 
converter) throws IOException {
     long fileLen = file.getLength();
-    String filePath = file.toString();
     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 
length: " + fileLen + ")");
+      throw new RuntimeException(file.toString() + " is not a Parquet file 
(too small length: " + fileLen + ")");
     }
     long footerLengthIndex = fileLen - FOOTER_LENGTH_SIZE - MAGIC.length;
     LOG.debug("reading footer index at {}", footerLengthIndex);
@@ -529,7 +528,7 @@ public class ParquetFileReader implements Closeable {
     byte[] magic = new byte[MAGIC.length];
     f.readFully(magic);
     if (!Arrays.equals(MAGIC, magic)) {
-      throw new RuntimeException(filePath + " is not a Parquet file. expected 
magic number at tail " + Arrays.toString(MAGIC) + " but found " + 
Arrays.toString(magic));
+      throw new RuntimeException(file.toString() + " is not a Parquet file. 
expected magic number at tail " + Arrays.toString(MAGIC) + " but found " + 
Arrays.toString(magic));
     }
     long footerIndex = footerLengthIndex - footerLength;
     LOG.debug("read footer length: {}, footer index: {}", footerLength, 
footerIndex);

Reply via email to