Skip to content

Commit 93c365a

Browse files
committed
Fix uint16 overflow bug in max vector
size and add independent reader/writer verification tests
1 parent 0c393e0 commit 93c365a

File tree

2 files changed

+721
-2
lines changed

2 files changed

+721
-2
lines changed

parquet-column/src/main/java/org/apache/parquet/column/values/alp/AlpConstants.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ private AlpConstants() {
5959
/** Log2 of the default vector size */
6060
public static final int DEFAULT_VECTOR_SIZE_LOG = 10;
6161

62-
/** Maximum allowed log2 of vector size */
63-
static final int MAX_LOG_VECTOR_SIZE = 16;
62+
/**
63+
* Maximum allowed log2 of vector size.
64+
* Capped at 15 (vectorSize=32768) because num_exceptions is uint16 (max 65535),
65+
* so vectorSize must not exceed 65535 to avoid overflow when all values are exceptions.
66+
*/
67+
static final int MAX_LOG_VECTOR_SIZE = 15;
6468

6569
/** Minimum allowed log2 of vector size */
6670
static final int MIN_LOG_VECTOR_SIZE = 3;

0 commit comments

Comments
 (0)