prestodb/presto · error · ParquetDecodingException

Corrupted Parquet file: extra %d values to be consumed when

Error message

Corrupted Parquet file: extra %d values to be consumed when scanning current batch

What it means

ParquetDecodingException thrown by UuidFlatBatchReader.readWithoutNull() when, after consuming all chunks for a batch, remainingInBatch is nonzero — the page contains more encoded values than the declared batch size. The library treats this as file corruption ('extra %d values to be consumed') because a no-null column chunk must consume exactly nextBatchSize values.

Source

Thrown at presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/UuidFlatBatchReader.java:224

        int remainingInBatch = nextBatchSize;
        int startOffset = 0;
        while (remainingInBatch > 0) {
            if (remainingCountInPage == 0) {
                if (!readNextPage()) {
                    break;
                }
            }

            int chunkSize = min(remainingCountInPage, remainingInBatch);

            valuesDecoder.readNext(values, startOffset, chunkSize);
            startOffset += chunkSize;
            remainingInBatch -= chunkSize;
            remainingCountInPage -= chunkSize;
        }

        if (remainingInBatch != 0) {
            throw new ParquetDecodingException(format("Corrupted Parquet file: extra %d values to be consumed when scanning current batch", remainingInBatch));
        }

        Block block = new Int128ArrayBlock(nextBatchSize, Optional.empty(), values);
        return new ColumnChunk(block, new int[0], new int[0]);
    }

    private void seek()
            throws IOException
    {
        if (readOffset == 0) {
            return;
        }

        int remainingInBatch = readOffset;
        int startOffset = 0;
        while (remainingInBatch > 0) {
            if (remainingCountInPage == 0) {
                if (!readNextPage()) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Validate and regenerate the Parquet file; verify page counts with parquet-tools dump.
  2. Check that the file wasn't truncated/partially rewritten by the producer.
  3. Upgrade the Presto reader — earlier versions had bugs tolerating writer quirks.
  4. If you control the writer, ensure page value counts match row-group/chunk metadata.

Example fix

// before
ColumnChunk chunk = reader.readNext(); // throws: extra N values to be consumed
// after
try {
    chunk = reader.readNext();
} catch (ParquetDecodingException e) {
    throw new RuntimeException("Corrupt non-null UUID page (extra values) in " + parquetPath, e);
}
Defensive patterns

Strategy: validation

Validate before calling

// verify declared chunk value count equals page values before decoding
long chunkValues = chunkMeta.getNumValues();
if (chunkValues != expectedBatchTotal) throw new IllegalStateException("Chunk value count mismatch: " + path);

Try / catch

try {
    chunk = reader.readNext();
} catch (ParquetDecodingException e) {
    // treat file as corrupt; quarantine with path context
    throw new RuntimeException("Corrupt non-null UUID page in " + path, e);
}

Prevention

When it happens

Trigger: readWithoutNull() (called from readNext() when the column is declared non-nullable) reads chunks in a loop; if the page still has extra values after filling nextBatchSize, this is thrown with the leftover count.

Common situations: Files written by writers whose page value counts exceed the chunk's declared count; corrupted or hand-edited Parquet files; mismatched metadata when a file is partially overwritten.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/39502e886f4b71f5. Report an issue: GitHub.