{"record":{"id":"3f0e0a3dd38a0312","repo":"prestodb/presto","slug":"could-not-decode-the-dictionary-for","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/batchreader/dictionary/Dictionaries.java","lineNumber":57,"sourceCode":"                case INT32:\n                case FLOAT:\n                    return new IntegerDictionary(dictionaryPage);\n                case INT64:\n                case DOUBLE:\n                    return new LongDictionary(dictionaryPage);\n                case INT96:\n                    return new TimestampDictionary(dictionaryPage, timezone);\n                case BINARY:\n                    return new BinaryBatchDictionary(dictionaryPage);\n                case FIXED_LEN_BYTE_ARRAY:\n                    return new BinaryBatchDictionary(dictionaryPage, columnDescriptor.getPrimitiveType().getTypeLength());\n                case BOOLEAN:\n                default:\n                    break;\n            }\n        }\n        catch (Exception e) {\n            throw new ParquetDecodingException(\"could not decode the dictionary for \" + columnDescriptor, e);\n        }\n\n        throw new PrestoException(PARQUET_UNSUPPORTED_ENCODING, String.format(\"Dictionary encoding is not supported: %s\", columnDescriptor));\n    }\n}\n","sourceCodeStart":39,"sourceCodeEnd":63,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/dictionary/Dictionaries.java#L39-L63","documentation":"Dictionaries.createDictionary() builds the appropriate Dictionary (Integer, Long, Timestamp, or Binary batch dictionary) based on the column descriptor's primitive type. Any exception thrown while constructing the dictionary page (e.g., invalid dictionary bytes, wrong value count, unsupported encoding inside the dictionary page) is caught and rethrown as ParquetDecodingException(\"could not decode the dictionary for \" + columnDescriptor, e), preserving the cause. This tells the developer the dictionary page for this column could not be materialized, so dictionary-encoded values in the data pages cannot be decoded.","triggerScenarios":"createDictionary() is called with a column descriptor plus DictionaryPage and the underlying dictionary page decoding (byte decoding, value count/length mismatch, negative sizes, truncation) throws any Exception — it is wrapped and rethrown with the column descriptor in the message.","commonSituations":"Corrupt or truncated dictionary pages in Parquet files; files written with a dictionary page size/value count inconsistent with the actual bytes; readers hitting a damaged block on HDFS/S3; writer bugs producing malformed dictionary encodings.","solutions":["Inspect the nested cause (getCause()) to find the true decoding failure (e.g., index out of bounds from truncation).","Validate the file with parquet-tools and re-export the data if the dictionary page is corrupt.","Re-fetch/copy the file — damage may come from storage-layer truncation (S3 multipart issues, HDFS under-replication).","Disable dictionary encoding on the writer (parquet.enable.dictionary=false) and rewrite so plain encoding is used."],"exampleFix":"// before\nDictionary dict = Dictionaries.createDictionary(descriptor, dictPage, tz);\n// ParquetDecodingException: could not decode the dictionary for ...\n\n// after: surface and handle the root cause\ncatch (ParquetDecodingException e) {\n    logger.error(e.getCause(), \"Dictionary page corrupt for %s in %s\", descriptor, path);\n    return readPlainEncoded(descriptor, path); // plain-encoding fallback\n}","handlingStrategy":"try-catch","validationCode":"// Verify the dictionary page is present and its size matches the column type\nif (dictionaryPage == null || dictionaryPage.getDictionarySize() <= 0) {\n    throw new PrestoException(PARQUET_CORRUPT_DATA, \"Missing/empty dictionary page for \" + column);\n}","typeGuard":null,"tryCatchPattern":"try {\n    Dictionary dict = Dictionaries.createDictionary(descriptor, dictPage, tz);\n} catch (ParquetDecodingException e) {\n    // e.getCause() holds the real decoding failure\n    logger.error(e.getCause(), \"Dictionary corrupt for %s in %s\", descriptor, path);\n    throw new PrestoException(PARQUET_CORRUPT_DATA, \"Re-export file \" + path, e);\n}","preventionTips":["Always inspect getCause(): the wrapped exception names the true failure.","Validate dictionary pages with parquet-tools after write jobs.","Enable storage checksums to catch truncated transfers early.","Disable dictionary encoding for columns with recurring dictionary corruption."],"tags":["parquet","dictionary-encoding","decoding","corrupt-data"],"backgroundTag":"parquet-decoding-failed","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"}