prestodb/presto · error · OrcCorruptionException

Value is not null but data stream is not present

Error message

Value is not null but data stream is not present

What it means

When skipping non-null positions, the reader computes how many data bytes to skip from the LENGTH stream; if that sum is positive, non-null data must exist, so a missing DATA stream indicates the ORC file is corrupt.

Source

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

    {
        if (!rowGroupOpen) {
            openRowGroup();
        }

        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 length reader
                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

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Validate the ORC file with orc-tools to confirm the missing DATA stream.
  2. Regenerate or restore the file from a healthy source.
  3. Check the ingestion pipeline for interrupted or partial uploads.
  4. Confirm the producing writer version is supported and compliant.
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: orc-tools scan file.orc to detect missing DATA streams across all row groups

Try / catch

try {
    return reader.readBlock();
} catch (OrcCorruptionException e) {
    log.error("Missing DATA stream despite non-zero length in %s", e.getOrcDataSourceId());
    throw new DataIntegrityException("ORC direct encoding incomplete", e);
}

Prevention

When it happens

Trigger: readBlock() with readOffset > 0 where lengthStream.sum(readOffset) > 0 but dataStream == null for the column in the current row group.

Common situations: ORC files with truncated DATA streams (e.g. partial uploads); writers that omit DATA while still writing lengths; storage corruption or manual file edits.

Related errors


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