{"record":{"id":"01ef082d857d1388","repo":"prestodb/presto","slug":"parquet-io-read-error-01ef08","errorCode":"PARQUET_IO_READ_ERROR","errorMessage":"Error reading parquet page ","messagePattern":"Error reading parquet page ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/decoders/Decoders.java","lineNumber":112,"sourceCode":"import static org.apache.parquet.bytes.BytesUtils.readIntLittleEndianOnOneByte;\nimport static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.BOOLEAN;\n\npublic class Decoders\n{\n    private Decoders()\n    {\n    }\n\n    public static FlatDecoders readFlatPage(DataPage page, RichColumnDescriptor columnDescriptor, Dictionary dictionary)\n    {\n        try {\n            if (page instanceof DataPageV1) {\n                return readFlatPageV1((DataPageV1) page, columnDescriptor, dictionary);\n            }\n            return readFlatPageV2((DataPageV2) page, columnDescriptor, dictionary);\n        }\n        catch (IOException e) {\n            throw new PrestoException(PARQUET_IO_READ_ERROR, \"Error reading parquet page \" + page + \" in column \" + columnDescriptor, e);\n        }\n    }\n\n    private static ValuesDecoder createValuesDecoder(ColumnDescriptor columnDescriptor, Dictionary dictionary, int valueCount, ParquetEncoding encoding, byte[] buffer, int offset, int length)\n            throws IOException\n    {\n        final PrimitiveTypeName type = columnDescriptor.getPrimitiveType().getPrimitiveTypeName();\n\n        if (encoding == PLAIN) {\n            switch (type) {\n                case BOOLEAN:\n                    return new BooleanPlainValuesDecoder(buffer, offset, length);\n                case INT32:\n                    if (isShortDecimalType(columnDescriptor)) {\n                        return new Int32ShortDecimalPlainValuesDecoder(buffer, offset, length);\n                    }\n                case FLOAT:\n                    return new Int32PlainValuesDecoder(buffer, offset, length);","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/decoders/Decoders.java#L94-L130","documentation":"PrestoException (PARQUET_IO_READ_ERROR) thrown by Decoders.readFlatPage() when reading a flat (non-nested) data page — V1 or V2 — throws an IOException. It converts stream/decode I/O failures on a single page into a typed error naming the page and column, preserving the cause.","triggerScenarios":"readFlatPage() is invoked per data page while decoding a column chunk; any IOException from readFlatPageV1/readFlatPageV2 (buffer wrap failures, RLE/dictionary decoding I/O, truncated page bytes) is wrapped here.","commonSituations":"Truncated page bytes from a corrupted or incomplete file; storage-layer read failures; pages whose declared length exceeds available bytes in the chunk.","solutions":["Inspect the cause IOException to distinguish truncation vs storage failure.","Verify the file integrity with parquet-tools; regenerate if corrupt.","Retry transient storage/network failures.","Compare page metadata (uncompressed/compressed sizes) with actual chunk bytes to confirm truncation."],"exampleFix":"// before\nValuesBlock vb = Decoders.readFlatPage(page, columnDescriptor, dictionary); // throws PARQUET_IO_READ_ERROR\n// after\ntry {\n    vb = Decoders.readFlatPage(page, columnDescriptor, dictionary);\n} catch (PrestoException e) {\n    log.error(\"Failed page %s in column %s\", page, columnDescriptor, e);\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"// ensure page bytes are present in the buffer before decoding\nif (page.getBufferSize() > chunkBuffer.remaining()) throw new IllegalStateException(\"Truncated page in \" + path);","typeGuard":null,"tryCatchPattern":"try {\n    vb = Decoders.readFlatPage(page, columnDescriptor, dictionary);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"PARQUET_IO_READ_ERROR\")) {\n        // log page + column, check cause IOException, retry transient failures\n    }\n    throw e;\n}","preventionTips":["Verify page sizes against chunk bytes before decode","Enable storage-layer retries","Validate files with parquet-tools","Include page/column context in logs"],"tags":["parquet","io","page-decoding","presto"],"backgroundTag":"parquet-io-read-error","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"}