diff --git ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/ParquetFooterInputFromCache.java ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/ParquetFooterInputFromCache.java index eb603d9621..e2e60670ca 100644 --- ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/ParquetFooterInputFromCache.java +++ ql/src/java/org/apache/hadoop/hive/ql/io/parquet/vector/ParquetFooterInputFromCache.java @@ -143,13 +143,13 @@ public int read(ByteBuffer bb) throws IOException { // Simple implementation for now - currently Parquet uses heap buffers. int result = -1; if (bb.hasArray()) { - result = readInternal(bb.array(), bb.arrayOffset(), result); + result = readInternal(bb.array(), bb.arrayOffset(), bb.remaining()); if (result > 0) { bb.position(bb.position() + result); } } else { byte[] b = new byte[bb.remaining()]; - result = readInternal(b, 0, result); + result = readInternal(b, 0, bb.remaining()); bb.put(b, 0, result); } return result;