{"record":{"id":"c8ee1a6793adb1ce","repo":"prestodb/presto","slug":"value-is-not-null-but-data-stream-is-missing-c8ee1a","errorCode":null,"errorMessage":"Value is not null but data stream is missing","messagePattern":"Value is not null but data stream is missing","errorType":"exception","errorClass":"OrcCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/reader/LongDirectBatchStreamReader.java","lineNumber":125,"sourceCode":"    }\n\n    @Override\n    public Block readBlock()\n            throws IOException\n    {\n        if (!rowGroupOpen) {\n            openRowGroup();\n        }\n\n        if (readOffset > 0) {\n            if (presentStream != null) {\n                // skip ahead the present bit reader, but count the set bits\n                // and use this as the skip size for the data reader\n                readOffset = presentStream.countBitsSet(readOffset);\n            }\n            if (readOffset > 0) {\n                if (dataStream == null) {\n                    throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), \"Value is not null but data stream is missing\");\n                }\n                dataStream.skip(readOffset);\n            }\n        }\n\n        Block block;\n        if (dataStream == null) {\n            if (presentStream == null) {\n                throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), \"Value is null but present stream is missing\");\n            }\n            presentStream.skip(nextBatchSize);\n            block = RunLengthEncodedBlock.create(type, null, nextBatchSize);\n        }\n        else if (presentStream == null) {\n            block = readNonNullBlock();\n        }\n        else {\n            boolean[] isNull = new boolean[nextBatchSize];","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/reader/LongDirectBatchStreamReader.java#L107-L143","documentation":"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.","triggerScenarios":"readOffset > 0 (prior row groups skipped, present bits counted) while dataStream == null for the direct-encoded integer column.","commonSituations":"Truncated or corrupt ORC files; writers that omit the DATA stream; failed/partial remote writes to S3/HDFS.","solutions":["Verify and rewrite the corrupt file(s) with orc-tools or recompute the partition","Restore data from a healthy backup","Fix or upgrade the ORC writer that produced the malformed stripe","Upgrade Presto to pick up improved stream-layout validation and readers"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-read: orc-tools verify data.orc to detect missing DATA streams","typeGuard":null,"tryCatchPattern":"try { ... } catch (OrcCorruptionException e) { quarantineAndRecover(e.getOrcDataSourceId()); }","preventionTips":["Verify ORC files in ingestion pipelines","Rewrite/repair truncated files before querying","Use consistent, supported writer versions","Keep partition-level backups for recovery"],"tags":["orc","corruption","direct-encoding","missing-stream"],"backgroundTag":"orc-corruption-missing-stream","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}