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

Validation guard in readBlock: the ORC stripe declared a present stream (nulls exist) but the required length/data stream for non-null slice values is absent, meaning the column chunk metadata is internally inconsistent — a corrupted or malformed file.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/SliceDirectBatchStreamReader.java:129

                readOffset = presentStream.countBitsSet(readOffset);
            }
            if (readOffset > 0) {
                if (lengthStream == null) {
                    throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but length stream is not present");
                }
                long dataSkipSize = lengthStream.sum(readOffset);
                if (dataSkipSize > 0) {
                    if (dataStream == null) {
                        throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but data stream is not present");
                    }
                    dataStream.skip(dataSkipSize);
                }
            }
        }

        if (lengthStream == null) {
            if (presentStream == null) {
                throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is null but present stream is missing");
            }
            presentStream.skip(nextBatchSize);
            Block nullValueBlock = readAllNullsBlock();
            readOffset = 0;
            nextBatchSize = 0;
            return nullValueBlock;
        }

        // create new isNullVector and offsetVector for VariableWidthBlock
        boolean[] isNullVector = null;

        // We will use the offsetVector as the buffer to read the length values from lengthStream,
        // and the length values will be converted in-place to an offset vector.
        int[] offsetVector = new int[nextBatchSize + 1];

        if (presentStream == null) {
            lengthStream.next(offsetVector, nextBatchSize);
        }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Drop and rewrite the corrupted ORC file from the source data
  2. Verify file integrity in object storage (checksums, multipart upload completeness)
  3. Wrap reads in a query fault-tolerance layer that skips/replaces bad splits
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/SliceDirectBatchStreamReader.java:129 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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