{"record":{"id":"c0c3ab5c79d0ae6a","repo":"apache/iceberg","slug":"could-not-decode-the-dictionary-for-desc","errorCode":null,"errorMessage":"could not decode the dictionary for <desc>","messagePattern":"could not decode the dictionary for <desc>","errorType":"exception","errorClass":"ParquetDecodingException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/ParquetUtil.java","lineNumber":154,"sourceCode":"      // if PLAIN_DICTIONARY wasn't present, then either the column is not\n      // dictionary-encoded, or the 2.0 encoding, RLE_DICTIONARY, was used.\n      // for 2.0, this cannot determine whether a page fell back without\n      // page encoding stats\n      return true;\n    }\n  }\n\n  public static boolean hasNoBloomFilterPages(ColumnChunkMetaData meta) {\n    return meta.getBloomFilterOffset() <= 0;\n  }\n\n  public static Dictionary readDictionary(ColumnDescriptor desc, PageReader pageSource) {\n    DictionaryPage dictionaryPage = pageSource.readDictionaryPage();\n    if (dictionaryPage != null) {\n      try {\n        return dictionaryPage.getEncoding().initDictionary(desc, dictionaryPage);\n      } catch (IOException e) {\n        throw new ParquetDecodingException(\"could not decode the dictionary for \" + desc, e);\n      }\n    }\n    return null;\n  }\n\n  public static boolean isIntType(PrimitiveType primitiveType) {\n    if (primitiveType.getOriginalType() != null) {\n      switch (primitiveType.getOriginalType()) {\n        case INT_8:\n        case INT_16:\n        case INT_32:\n        case DATE:\n          return true;\n        default:\n          return false;\n      }\n    }\n    return primitiveType.getPrimitiveTypeName() == PrimitiveType.PrimitiveTypeName.INT32;","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/ParquetUtil.java#L136-L172","documentation":"ParquetUtil.readDictionary fetches the dictionary page for a column and asks Parquet's encoding to build a Dictionary. If dictionary decoding throws IOException, it is wrapped in ParquetDecodingException with the column descriptor in the message. This indicates a corrupt or unreadable dictionary page for that column.","triggerScenarios":"Reading a column that uses dictionary encoding where pageSource.readDictionaryPage() returns a page whose bytes cannot be decoded (corrupt page, wrong encoding flag, truncated dictionary data).","commonSituations":"Reading files damaged by interrupted writes or bad storage; files written by writers with encoding bugs; mismatched/incorrect column descriptors passed to readDictionary.","solutions":["Validate the Parquet file for corruption (parquet-tools / metadata dump) and rewrite from source data.","Confirm the file's writer version/encodings are supported by your Parquet library version; upgrade if needed.","Re-read from a valid table snapshot if the file was produced by a failed commit.","If the column can be read without dictionary, check whether disabling vectorized/dictionary-based reads in the engine helps isolate the issue."],"exampleFix":"// before\nDictionary dict = ParquetUtil.readDictionary(desc, pageSource); // ParquetDecodingException\n// after\ntry {\n  Dictionary dict = ParquetUtil.readDictionary(desc, pageSource);\n} catch (ParquetDecodingException e) {\n  LOG.error(\"Corrupt dictionary for column {}\", desc, e);\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  Dictionary dict = ParquetUtil.readDictionary(desc, pageSource);\n} catch (ParquetDecodingException e) {\n  LOG.error(\"Bad dictionary for {}\", desc, e);\n  throw e;\n}","preventionTips":["Validate suspicious files with parquet-tools before scanning.","Keep Parquet library versions current for writer-compat bug fixes.","Rewrite corrupt files from source snapshots."],"tags":["parquet","dictionary","decoding","corrupt-file"],"backgroundTag":"checksum-mismatch","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}