{"record":{"id":"32416d441e293ad1","repo":"prestodb/presto","slug":"could-not-decode-the-dictionary-for-32416d","errorCode":null,"errorMessage":"could not decode the dictionary for ","messagePattern":"could not decode the dictionary for ","errorType":"exception","errorClass":"ParquetDecodingException","httpStatus":null,"severity":"error","filePath":"presto-parquet/src/main/java/com/facebook/presto/parquet/reader/AbstractColumnReader.java","lineNumber":115,"sourceCode":"    @Override\n    public boolean isInitialized()\n    {\n        return pageReader != null && field != null;\n    }\n\n    @Override\n    public void init(PageReader pageReader, Field field, RowRanges rowRanges, Optional<DateTimeZone> timezone)\n    {\n        this.pageReader = requireNonNull(pageReader, \"pageReader is null\");\n        this.field = requireNonNull(field, \"field is null\");\n        DictionaryPage dictionaryPage = pageReader.readDictionaryPage();\n\n        if (dictionaryPage != null) {\n            try {\n                dictionary = dictionaryPage.getEncoding().initDictionary(columnDescriptor, dictionaryPage);\n            }\n            catch (IOException e) {\n                throw new ParquetDecodingException(\"could not decode the dictionary for \" + columnDescriptor, e);\n            }\n        }\n        else {\n            dictionary = null;\n        }\n        checkArgument(pageReader.getValueCountInColumnChunk() > 0, \"page is empty\");\n        valueCountInColumnChunk = pageReader.getValueCountInColumnChunk();\n        indexIterator = (rowRanges == null) ? null : rowRanges.iterator();\n    }\n\n    @Override\n    public void prepareNextRead(int batchSize)\n    {\n        readOffset = readOffset + nextBatchSize;\n        nextBatchSize = batchSize;\n    }\n\n    @Override","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/reader/AbstractColumnReader.java#L97-L133","documentation":"Thrown in AbstractColumnReader.init when the dictionary page for a column chunk exists but its encoding fails to initialize a Dictionary object. The original IOException is wrapped in a ParquetDecodingException naming the column descriptor. This means the file declares a dictionary for the column but the dictionary page bytes/encoding cannot be decoded by this reader.","triggerScenarios":"dictionaryPage != null and dictionaryPage.getEncoding().initDictionary(columnDescriptor, dictionaryPage) throws IOException — corrupt or truncated dictionary page, dictionary encoded with PLAIN_DICTIONARY/RLE_DICTIONARY bytes this reader cannot parse, or a dictionary page whose contents don't match the column schema.","commonSituations":"Files corrupted in transit or truncated by a failed copy; files written by a writer producing dictionary pages with encodings or bit widths Presto's reader mishandles; HDFS/S3 reads returning partial data; writer bugs (e.g. old versions of certain writers writing malformed dictionaries).","solutions":["Verify the file integrity (re-copy / checksum) and re-read; a truncated or corrupted dictionary page is the most common cause.","Rewrite the file with dictionary encoding disabled (e.g. parquet.writer.dictionary... or parquet-tools rewrite) so no dictionary page is present.","Check the writer version that produced the file; if a known writer bug, re-export the data with a fixed/newer writer.","Upgrade Presto in case initDictionary lacks support for the encoding used by the writer.","As a fallback, disable predicate pushdown/scan that column via a full rewrite to PLAIN encoding."],"exampleFix":"// before (reading corrupt file directly)\nSELECT col FROM corrupted_table;  -- ParquetDecodingException: could not decode the dictionary for ...\n\n// after (rewrite without dictionary encoding, then read)\n// $ parquet-tools rewrite --disable-dictionary bad.parquet fixed.parquet\nSELECT col FROM fixed_table;","handlingStrategy":"try-catch","validationCode":"// Validate the file before scanning: dump dictionary pages\n// $ parquet-tools dump file.parquet | head   # fails/errs on corrupt dictionary\nboolean readable = new ParquetMetadataReader().readFooter(file) != null;","typeGuard":null,"tryCatchPattern":"try {\n    // scan / initColumnReader\n}\ncatch (ParquetDecodingException e) {\n    if (e.getMessage().startsWith(\"could not decode the dictionary for\")) {\n        logger.warn(\"Corrupt dictionary, falling back to rewrite/plain read\", e);\n        // fall back to reading a rewritten (non-dictionary) copy\n    } else {\n        throw e;\n    }\n}","preventionTips":["Verify checksums after copying Parquet files between storage systems.","Use atomic/complete uploads so files are never read while truncated.","Periodically validate files with parquet-tools in CI.","Rewrite files from buggy writers with a current Parquet version."],"tags":["parquet","dictionary","decoding","corrupt-data"],"backgroundTag":"parquet-dictionary-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"}