{"record":{"id":"30604539d3b03b94","repo":"prestodb/presto","slug":"end-of-stream-in-rle-integer-306045","errorCode":null,"errorMessage":"End of stream in RLE Integer","messagePattern":"End of stream in RLE Integer","errorType":"error_code","errorClass":"OrcCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/stream/OrcInputStream.java","lineNumber":356,"sourceCode":"                    result |= (word & 0x7f) << 56;\n                    if ((word & 0x80) == 0) {\n                        count++;\n                    }\n                    else {\n                        result |= 1L << 63;\n                        count += 2;\n                    }\n                }\n            }\n            position += count;\n        }\n        else {\n            do {\n                if (available == 0) {\n                    advance();\n                    available = available();\n                    if (available == 0) {\n                        throw new OrcCorruptionException(orcDataSourceId, \"End of stream in RLE Integer\");\n                    }\n                }\n                available--;\n                result |= (long) (buffer[position] & 0x7f) << shift;\n                shift += 7;\n            }\n            while ((buffer[position++] & 0x80) != 0);\n        }\n        if (signed) {\n            return zigzagDecode(result);\n        }\n        else {\n            return result;\n        }\n    }\n\n    public void skipVarints(long items)\n            throws IOException","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/stream/OrcInputStream.java#L338-L374","documentation":"readVarint decodes protobuf-style variable-length integers from the stream. If the stream runs out mid-varint (no bytes available even after advancing), the encoding is incomplete and OrcCorruptionException 'End of stream in RLE Integer' is thrown.","triggerScenarios":"readVarint called on a stream whose bytes end while the varint continuation bit is still set (byte with high bit 1 followed by EOF).","commonSituations":"Truncated ORC file cut off in the middle of an integer-RLE run; corrupted byte stream producing a bogus trailing varint; byte-encoding version mismatch between reader and writer.","solutions":["Verify file completeness and re-transfer the file.","Check the file with orc-tools to locate the corrupt byte offset.","Ensure the reader's byte-encoding setting (version/DWRF variant) matches the file format.","Reopen with fresh metadata in case offsets were stale."],"exampleFix":"// before: reading truncated stream\nlong v = inputStream.readVarint();\n// after\nif (inputStream.available() == 0) {\n    throw new IOException(\"stream ended before varint complete\");\n}\nlong v = inputStream.readVarint();","handlingStrategy":"try-catch","validationCode":"if (stream.available() == 0) throw new IOException(\"stream exhausted before varint\");","typeGuard":null,"tryCatchPattern":"try { long v = stream.readVarint(); } catch (OrcCorruptionException e) {\n    throw new DataReadException(\"RLE stream truncated mid-varint\", e);\n}","preventionTips":["Validate file completeness before reading stripes.","Match reader byte-encoding/version flags with the writer.","Quarantine corrupt files found by orc-tools scans.","Avoid reading files during partial writes."],"tags":["orc","rle","corruption","truncated-file"],"backgroundTag":"unexpected-eof-orc-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"}