prestodb/presto · error · OrcCorruptionException

Value is not null but data stream is missing

Error message

Value is not null but data stream is missing

What it means

LongDirectBatchStreamReader.readBlock throws OrcCorruptionException when it needs to skip readOffset non-null values but the DATA stream is absent. Skipping forward requires the direct data stream, so its absence means the stripe's stream set contradicts the presence of readable rows.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/LongDirectBatchStreamReader.java:125

    }

    @Override
    public Block readBlock()
            throws IOException
    {
        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 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];

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify and rewrite the corrupt file(s) with orc-tools or recompute the partition
  2. Restore data from a healthy backup
  3. Fix or upgrade the ORC writer that produced the malformed stripe
  4. Upgrade Presto to pick up improved stream-layout validation and readers
Defensive patterns

Strategy: validation

Validate before calling

// Pre-read: orc-tools verify data.orc to detect missing DATA streams

Try / catch

try { ... } catch (OrcCorruptionException e) { quarantineAndRecover(e.getOrcDataSourceId()); }

Prevention

When it happens

Trigger: readOffset > 0 (prior row groups skipped, present bits counted) while dataStream == null for the direct-encoded integer column.

Common situations: Truncated or corrupt ORC files; writers that omit the DATA stream; failed/partial remote writes to S3/HDFS.

Related errors


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