Skip to content

Commit 7334be2

Browse files
committed
PARQUET-511: Integer overflow when counting values in column.
This commit fixes an issue when the number of entries in a column page is larger than the size of an integer. No exception is thrown directly, but the def level is set incorrectly, leading to a null value being returned during read.
1 parent 0a711eb commit 7334be2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

parquet-column/src/main/java/org/apache/parquet/column/impl/ColumnReaderImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public double getDouble() {
150150
private int dictionaryId;
151151

152152
private long endOfPageValueCount;
153-
private int readValues = 0;
153+
private long readValues = 0;
154154
private int pageValueCount = 0;
155155

156156
private final PrimitiveConverter converter;
@@ -352,7 +352,7 @@ public ColumnReaderImpl(ColumnDescriptor path, PageReader pageReader, PrimitiveC
352352
this.dictionary = null;
353353
}
354354
this.totalValueCount = pageReader.getTotalValueCount();
355-
if (totalValueCount == 0) {
355+
if (totalValueCount <= 0) {
356356
throw new ParquetDecodingException("totalValueCount == 0");
357357
}
358358
consume();

parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ColumnChunkPageReadStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static final class ColumnChunkPageReader implements PageReader {
6363
this.decompressor = decompressor;
6464
this.compressedPages = new LinkedList<DataPage>(compressedPages);
6565
this.compressedDictionaryPage = compressedDictionaryPage;
66-
int count = 0;
66+
long count = 0;
6767
for (DataPage p : compressedPages) {
6868
count += p.getValueCount();
6969
}

0 commit comments

Comments
 (0)