{"record":{"id":"f42836bc4e551073","repo":"prestodb/presto","slug":"error-reading-parquet-page-in-column","errorCode":null,"errorMessage":"Error reading parquet page  in column ","messagePattern":"Error reading parquet page  in column ","errorType":"exception","errorClass":"ParquetDecodingException","httpStatus":null,"severity":"error","filePath":"presto-parquet/src/main/java/com/facebook/presto/parquet/reader/AbstractColumnReader.java","lineNumber":312,"sourceCode":"        remainingValueCountInPage -= totalCount;\n        currentValueCount += valuesRead;\n    }\n\n    private ValuesReader readPageV1(DataPageV1 page)\n    {\n        ValuesReader repetitionLevelReader = page.getRepetitionLevelEncoding().getValuesReader(columnDescriptor, REPETITION_LEVEL);\n        ValuesReader definitionLevelReader = page.getDefinitionLevelEncoding().getValuesReader(columnDescriptor, DEFINITION_LEVEL);\n        repetitionReader = new LevelValuesReader(repetitionLevelReader);\n        definitionReader = new LevelValuesReader(definitionLevelReader);\n        try {\n            ByteBufferInputStream bufferInputStream = ByteBufferInputStream.wrap(page.getSlice().toByteBuffer());\n            repetitionLevelReader.initFromPage(page.getValueCount(), bufferInputStream);\n            definitionLevelReader.initFromPage(page.getValueCount(), bufferInputStream);\n            long firstRowIndex = page.getFirstRowIndex().orElse(-1L);\n            return initDataReader(page.getValueEncoding(), bufferInputStream, page.getValueCount(), firstRowIndex);\n        }\n        catch (IOException e) {\n            throw new ParquetDecodingException(\"Error reading parquet page \" + page + \" in column \" + columnDescriptor, e);\n        }\n    }\n\n    private ValuesReader readPageV2(DataPageV2 page)\n    {\n        repetitionReader = buildLevelRLEReader(columnDescriptor.getMaxRepetitionLevel(), page.getRepetitionLevels());\n        definitionReader = buildLevelRLEReader(columnDescriptor.getMaxDefinitionLevel(), page.getDefinitionLevels());\n        long firstRowIndex = page.getFirstRowIndex().orElse(-1L);\n        return initDataReader(page.getDataEncoding(), ByteBufferInputStream.wrap(ImmutableList.of(page.getSlice().toByteBuffer())), page.getValueCount(), firstRowIndex);\n    }\n\n    private LevelReader buildLevelRLEReader(int maxLevel, Slice slice)\n    {\n        if (maxLevel == 0) {\n            return new LevelNullReader();\n        }\n\n        return new LevelRLEReader(new RunLengthBitPackingHybridDecoder(BytesUtils.getWidthFromMaxInt(maxLevel), slice.getInput()));","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/reader/AbstractColumnReader.java#L294-L330","documentation":"readPageV1 wraps any IOException raised while decoding a DataPageV1 — reading repetition/definition levels or initializing the values reader via initDataReader — into a ParquetDecodingException naming the page and column descriptor. It signals that a page's serialized bytes could not be parsed according to the Parquet V1 page format.","triggerScenarios":"readNextPage -> readPageV1 on a DataPageV1 where uncompressing/parsing the page buffer throws IOException: corrupted or truncated page bytes, wrong compression codec metadata, a page whose declared valueCount exceeds the actual buffer, or a decompression failure.","commonSituations":"Truncated files from failed S3/HDFS copies; files written with compression codecs the reader's codec stack can't decompress; disk/network corruption; writer bugs producing malformed V1 pages; reading with Presto a file written by an incompatible/buggy writer version.","solutions":["Re-read / re-fetch the file and validate checksums; truncated or corrupted page bytes are the most common cause.","Check the file's compression codec metadata (parquet-tools meta) and ensure the Presto runtime supports that codec (e.g. zstd/LZO availability).","Rewrite the file with a modern writer ( uncompressed or snappy ) to regenerate valid pages.","Upgrade Presto / parquet-mr in case of a known page-parsing incompatibility with the writer version.","Identify the writer via file metadata (created_by) and re-export the data if the writer had a known page-serialization bug."],"exampleFix":"// before\nSELECT * FROM corrupt_parquet_table;  -- ParquetDecodingException: Error reading parquet page ...\n\n// after (regenerate the file, e.g. re-export from source)\n// $ parquet-tools cat bad.parquet  # confirm corruption locally\n// re-export the table, then query the new table","handlingStrategy":"try-catch","validationCode":"// Pre-flight integrity check on the source file\n// $ parquet-tools meta file.parquet   # throws on malformed pages/metadata","typeGuard":null,"tryCatchPattern":"try {\n    // read pages / execute query\n}\ncatch (ParquetDecodingException e) {\n    if (e.getMessage().startsWith(\"Error reading parquet page\")) {\n        logger.error(\"Unreadable page: {}\", e.getMessage());\n        // quarantine the file and retry from a verified copy\n    } else {\n        throw e;\n    }\n}","preventionTips":["Enable end-to-end checksums (S3/HDFS) to catch corrupted page bytes early.","Ensure Presto's codec support (zstd, lzo, etc.) matches the writer's compression choice.","Check the file's created_by metadata against known writer bugs before ingesting.","Re-export data that fails parquet-tools validation instead of patching around it."],"tags":["parquet","page-decoding","corrupt-data","io"],"backgroundTag":"parquet-page-decode-failure","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"}