prestodb/presto · error · OrcCorruptionException
End of stream in RLE Integer
Error message
End of stream in RLE Integer
What it means
readVarint decodes protobuf-style variable-length integers from the stream. If the stream runs out mid-varint (no bytes available even after advancing), the encoding is incomplete and OrcCorruptionException 'End of stream in RLE Integer' is thrown.
Source
Thrown at presto-orc/src/main/java/com/facebook/presto/orc/stream/OrcInputStream.java:356
result |= (word & 0x7f) << 56;
if ((word & 0x80) == 0) {
count++;
}
else {
result |= 1L << 63;
count += 2;
}
}
}
position += count;
}
else {
do {
if (available == 0) {
advance();
available = available();
if (available == 0) {
throw new OrcCorruptionException(orcDataSourceId, "End of stream in RLE Integer");
}
}
available--;
result |= (long) (buffer[position] & 0x7f) << shift;
shift += 7;
}
while ((buffer[position++] & 0x80) != 0);
}
if (signed) {
return zigzagDecode(result);
}
else {
return result;
}
}
public void skipVarints(long items)
throws IOExceptionView on GitHub (pinned to 55bb57d202)
Solutions
- Verify file completeness and re-transfer the file.
- Check the file with orc-tools to locate the corrupt byte offset.
- Ensure the reader's byte-encoding setting (version/DWRF variant) matches the file format.
- Reopen with fresh metadata in case offsets were stale.
Example fix
// before: reading truncated stream
long v = inputStream.readVarint();
// after
if (inputStream.available() == 0) {
throw new IOException("stream ended before varint complete");
}
long v = inputStream.readVarint(); Defensive patterns
Strategy: try-catch
Validate before calling
if (stream.available() == 0) throw new IOException("stream exhausted before varint"); Try / catch
try { long v = stream.readVarint(); } catch (OrcCorruptionException e) {
throw new DataReadException("RLE stream truncated mid-varint", e);
} Prevention
- Validate file completeness before reading stripes.
- Match reader byte-encoding/version flags with the writer.
- Quarantine corrupt files found by orc-tools scans.
- Avoid reading files during partial writes.
When it happens
Trigger: readVarint called on a stream whose bytes end while the varint continuation bit is still set (byte with high bit 1 followed by EOF).
Common situations: Truncated ORC file cut off in the middle of an integer-RLE run; corrupted byte stream producing a bogus trailing varint; byte-encoding version mismatch between reader and writer.
Related errors
- Read past end of buffer RLE byte
- Reading RLE byte got EOF
- Unexpected end of stream
- Read past end of RLE integer
- End of stream in RLE Integer
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/30604539d3b03b94.
Report an issue: GitHub.