prestodb/presto · error · ParquetDecodingException

could not decode the dictionary for

Error message

could not decode the dictionary for 

What it means

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.

Source

Thrown at presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/dictionary/Dictionaries.java:57

                case INT32:
                case FLOAT:
                    return new IntegerDictionary(dictionaryPage);
                case INT64:
                case DOUBLE:
                    return new LongDictionary(dictionaryPage);
                case INT96:
                    return new TimestampDictionary(dictionaryPage, timezone);
                case BINARY:
                    return new BinaryBatchDictionary(dictionaryPage);
                case FIXED_LEN_BYTE_ARRAY:
                    return new BinaryBatchDictionary(dictionaryPage, columnDescriptor.getPrimitiveType().getTypeLength());
                case BOOLEAN:
                default:
                    break;
            }
        }
        catch (Exception e) {
            throw new ParquetDecodingException("could not decode the dictionary for " + columnDescriptor, e);
        }

        throw new PrestoException(PARQUET_UNSUPPORTED_ENCODING, String.format("Dictionary encoding is not supported: %s", columnDescriptor));
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Inspect the nested cause (getCause()) to find the true decoding failure (e.g., index out of bounds from truncation).
  2. Validate the file with parquet-tools and re-export the data if the dictionary page is corrupt.
  3. Re-fetch/copy the file — damage may come from storage-layer truncation (S3 multipart issues, HDFS under-replication).
  4. Disable dictionary encoding on the writer (parquet.enable.dictionary=false) and rewrite so plain encoding is used.

Example fix

// before
Dictionary dict = Dictionaries.createDictionary(descriptor, dictPage, tz);
// ParquetDecodingException: could not decode the dictionary for ...

// after: surface and handle the root cause
catch (ParquetDecodingException e) {
    logger.error(e.getCause(), "Dictionary page corrupt for %s in %s", descriptor, path);
    return readPlainEncoded(descriptor, path); // plain-encoding fallback
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the dictionary page is present and its size matches the column type
if (dictionaryPage == null || dictionaryPage.getDictionarySize() <= 0) {
    throw new PrestoException(PARQUET_CORRUPT_DATA, "Missing/empty dictionary page for " + column);
}

Try / catch

try {
    Dictionary dict = Dictionaries.createDictionary(descriptor, dictPage, tz);
} catch (ParquetDecodingException e) {
    // e.getCause() holds the real decoding failure
    logger.error(e.getCause(), "Dictionary corrupt for %s in %s", descriptor, path);
    throw new PrestoException(PARQUET_CORRUPT_DATA, "Re-export file " + path, e);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/3f0e0a3dd38a0312. Report an issue: GitHub.