{"record":{"id":"67b0c2935d74f170","repo":"prestodb/presto","slug":"value-is-not-null-but-data-stream-is-not-present","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/BooleanBatchStreamReader.java","lineNumber":103,"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 not present\");\n                }\n                dataStream.skip(readOffset);\n            }\n        }\n\n        if (dataStream == null && presentStream != null) {\n            presentStream.skip(nextBatchSize);\n            Block nullValueBlock = RunLengthEncodedBlock.create(BOOLEAN, null, nextBatchSize);\n            readOffset = 0;\n            nextBatchSize = 0;\n            return nullValueBlock;\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            }","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/reader/BooleanBatchStreamReader.java#L85-L121","documentation":"BooleanBatchStreamReader.readBlock throws OrcCorruptionException when a boolean column has non-null values to read (present stream indicates set bits) but the underlying boolean DATA stream is absent from the file. Per the ORC spec, any column with non-null values must carry a data stream, so this signals a truncated or malformed file.","triggerScenarios":"Skipping into a BOOLEAN column (readOffset > 0 via setRowOffset) where countBitsSet found non-null positions but dataStream is null; generally any read of a BOOLEAN column whose data stream is missing while present stream marks values non-null.","commonSituations":"ORC files truncated mid-write (writer crashed before flushing data streams); files copied incompletely from HDFS/S3; files produced by faulty third-party ORC writers.","solutions":["Verify file integrity and re-copy/regenerate the ORC file from the source data.","Use orc-tools 'meta'/'scan' to confirm missing streams in the stripe/footer.","Check that writers complete and close files properly (no crash mid-stripe).","Upgrade the ORC writer version if known bugs caused missing streams."],"exampleFix":"// before: querying a truncated file directly\nSELECT bool_col FROM corrupted_table;\n// after: regenerate the file, or guard the read\ntry { ... reader.readBlock(...) } catch (OrcCorruptionException e) { log.error(\"missing data stream, regenerate file\"); }","handlingStrategy":"try-catch","validationCode":"// validate file has expected streams before read\n// orc-tools meta file.orc  -- confirm DATA stream exists for boolean columns","typeGuard":null,"tryCatchPattern":"try { block = streamReader.readBlock(); } catch (OrcCorruptionException e) { markSplitFailed(e); }","preventionTips":["Ensure writers close files atomically (temp-then-rename)","Verify checksums after copying ORC files","Never read files still being written"],"tags":["orc","corruption","boolean","missing-stream","presto"],"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"}