prestodb/presto · error · OrcCorruptionException
Value is null but present stream is missing
Error message
Value is null but present stream is missing
What it means
If the DATA stream is null, all values in the batch must be null and the reader needs the PRESENT stream to know which rows are null. If presentStream is also null the layout is contradictory — the file claims a stream exists for a column that should be all-null — so readBlock throws OrcCorruptionException.
Source
Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/LongDirectBatchStreamReader.java:134
if (readOffset > 0) {
if (presentStream != null) {
// skip ahead the present bit reader, but count the set bits
// and use this as the skip size for the data reader
readOffset = presentStream.countBitsSet(readOffset);
}
if (readOffset > 0) {
if (dataStream == null) {
throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but data stream is missing");
}
dataStream.skip(readOffset);
}
}
Block block;
if (dataStream == null) {
if (presentStream == null) {
throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is null but present stream is missing");
}
presentStream.skip(nextBatchSize);
block = RunLengthEncodedBlock.create(type, null, nextBatchSize);
}
else if (presentStream == null) {
block = readNonNullBlock();
}
else {
boolean[] isNull = new boolean[nextBatchSize];
int nullCount = presentStream.getUnsetBits(nextBatchSize, isNull);
if (nullCount == 0) {
block = readNonNullBlock();
}
else if (nullCount != nextBatchSize) {
block = readNullBlock(isNull, nextBatchSize - nullCount);
}
else {
block = RunLengthEncodedBlock.create(type, null, nextBatchSize);View on GitHub (pinned to 55bb57d202)
Solutions
- Verify/rewrite the corrupt files (orc-tools verify, Hive rewrite of the partition)
- Restore affected partitions from backup
- Fix/upgrade the producing writer so all-null columns include a PRESENT stream or correct row-group metadata
- Upgrade Presto for more robust handling of all-null columns
Defensive patterns
Strategy: validation
Validate before calling
// orc-tools meta: confirm all-null columns still carry a PRESENT stream
Try / catch
try { ... } catch (OrcCorruptionException e) { rewriteCorruptPartition(); } Prevention
- Verify files post-write with orc-tools
- Ensure writers emit PRESENT streams for all-null columns
- Restore corrupt partitions from backups
- Upgrade Presto/writer for known all-null handling fixes
When it happens
Trigger: readBlock where dataStream == null and presentStream == null while nextBatchSize > 0.
Common situations: Corrupt ORC files; writers incorrectly emitting neither DATA nor PRESENT streams; partial writes or storage-layer truncation.
Related errors
- Value is not null but data stream is not present
- Value is not null but data stream is missing
- Value is not null but decimal stream is not present
- Value is not null but scale stream is not present
- Value is not null but data stream is not present
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/39fdcc28fabeb73f.
Report an issue: GitHub.