{"record":{"id":"472ab40b9c0a2e30","repo":"prestodb/presto","slug":"value-is-not-null-but-data-stream-is-not-present-472ab4","errorCode":null,"errorMessage":"Value is not null but data stream is not present","messagePattern":"Value is not null but data stream is not present","errorType":"exception","errorClass":"OrcCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/reader/LongDictionaryBatchStreamReader.java","lineNumber":120,"sourceCode":"    {\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 length reader\n                readOffset = presentStream.countBitsSet(readOffset);\n            }\n\n            if (inDictionaryStream != null) {\n                inDictionaryStream.skip(readOffset);\n            }\n\n            if (readOffset > 0) {\n                if (dataStream == null) {\n                    throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), \"Value is not null but data stream is not present\");\n                }\n                dataStream.skip(readOffset);\n            }\n        }\n\n        BlockBuilder builder = type.createBlockBuilder(null, nextBatchSize);\n\n        if (presentStream == null) {\n            // Data doesn't have nulls\n            if (dataStream == null) {\n                throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), \"Value is not null but data stream is not present\");\n            }\n            if (inDictionaryStream == null) {\n                for (int i = 0; i < nextBatchSize; i++) {\n                    type.writeLong(builder, dictionary[((int) dataStream.next())]);\n                }\n            }\n            else {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/reader/LongDictionaryBatchStreamReader.java#L102-L138","documentation":"LongDictionaryBatchStreamReader.readBlock throws OrcCorruptionException when it must skip forward past already-read values (readOffset > 0) but the column's data stream is absent. A non-null data stream is mandatory whenever rows must be read or skipped, so its absence indicates the ORC stripe's stream layout contradicts what the metadata promised.","triggerScenarios":"readOffset > 0 (row-group skip or resume) while dataStream == null for the dictionary-encoded BIGINT column.","commonSituations":"Truncated or corrupt ORC files; files written by buggy/foreign writers omitting the DATA stream; partial S3/HDFS writes; corruption introduced by the Java ORC writer bug (deprecated LongDictionaryBatchStreamReader).","solutions":["Validate/rewrite the file with ORC tooling (orc-tools verify / rewriting via Hive) to repair or regenerate the data","Identify and fix the writer that produced the file; check hive.orc.writer.* config and writer version","Point the table at a healthy copy of the data (backup/recompute the partition)","Upgrade Presto; this class is deprecated in favor of LongDictionaryBatchV2StreamReader which is more robust"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Detect corrupt files before query:\n// java -jar orc-tools-*.jar verify data.orc","typeGuard":null,"tryCatchPattern":"try { ... } catch (OrcCorruptionException e) { quarantineFile(e.getOrcDataSourceId()); }","preventionTips":["Run orc-tools verify on ingested ORC files","Restore/rewrite corrupt partitions instead of retrying reads","Standardize on one supported writer version","Prefer the V2 dictionary batch reader via a current Presto version"],"tags":["orc","corruption","dictionary-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"}