You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by bo...@apache.org on 2018/07/06 17:44:32 UTC
[drill] branch master updated: DRILL-6570: Fixed
IndexOutofBoundException in Parquet Reader
This is an automated email from the ASF dual-hosted git repository.
boaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push:
new aee899c DRILL-6570: Fixed IndexOutofBoundException in Parquet Reader
aee899c is described below
commit aee899c1b26ebb9a5781d280d5a73b42c273d4d5
Author: Salim Achouche <sa...@gmail.com>
AuthorDate: Fri Jun 29 19:58:12 2018 -0700
DRILL-6570: Fixed IndexOutofBoundException in Parquet Reader
---
.../columnreaders/VarLenColumnBulkEntry.java | 32 ++++++++--------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLenColumnBulkEntry.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLenColumnBulkEntry.java
index bc77415..e37700a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLenColumnBulkEntry.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLenColumnBulkEntry.java
@@ -18,7 +18,7 @@
package org.apache.drill.exec.store.parquet.columnreaders;
import org.apache.drill.exec.store.parquet.columnreaders.VarLenColumnBulkInput.ColumnPrecisionInfo;
-import org.apache.drill.exec.store.parquet.columnreaders.VarLenColumnBulkInput.ColumnPrecisionType;
+import org.apache.drill.exec.vector.UInt4Vector;
import org.apache.drill.exec.vector.VarLenBulkEntry;
import io.netty.buffer.DrillBuf;
@@ -55,25 +55,17 @@ final class VarLenColumnBulkEntry implements VarLenBulkEntry {
}
VarLenColumnBulkEntry(ColumnPrecisionInfo columnPrecInfo, int buffSz) {
- int lengthSz = -1;
- int dataSz = -1;
-
- if (ColumnPrecisionType.isPrecTypeFixed(columnPrecInfo.columnPrecisionType)) {
- final int expectedDataLen = columnPrecInfo.precision;
- final int maxNumValues = buffSz / (4 + expectedDataLen);
- lengthSz = maxNumValues;
- dataSz = maxNumValues * expectedDataLen + PADDING;
-
- } else {
- // For variable length data, we need to handle a) maximum number of entries and b) max entry length
- final int smallestDataLen = 1;
- final int largestDataLen = buffSz - 4;
- final int maxNumValues = buffSz / (4 + smallestDataLen);
- lengthSz = maxNumValues;
- dataSz = largestDataLen + PADDING;
- }
-
- this.lengths = new int[lengthSz];
+
+ // For variable length data, we need to handle a) maximum number of entries
+ // and b) max entry length. Note that we don't optimize for fixed length
+ // columns as the reader can notice a false-positive (that is, the first
+ // values were fixed but not the rest).
+ final int largestDataLen = buffSz - UInt4Vector.VALUE_WIDTH;
+ final int maxNumValues = buffSz / UInt4Vector.VALUE_WIDTH;
+ final int lengthSz = maxNumValues;
+ final int dataSz = largestDataLen + PADDING;
+
+ this.lengths = new int[lengthSz];
this.internalArray = new byte[dataSz];
}