prestodb/presto · error · IllegalArgumentException

Unsupported encoding:

Error message

Unsupported encoding: 

What it means

BinaryDeltaValuesDecoder's constructor selects an inner values reader based on the Parquet encodings enum: DELTA_BINARY_PACKED, DELTA_BYTE_ARRAY, or DELTA_LENGTH_BYTE_ARRAY. Any other encoding is rejected with an IllegalArgumentException because binary delta decoding only supports those three encodings.

Source

Thrown at presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/decoders/delta/BinaryDeltaValuesDecoder.java:53

 */
public class BinaryDeltaValuesDecoder
        implements BinaryValuesDecoder
{
    private static final int INSTANCE_SIZE = ClassLayout.parseClass(BinaryDeltaValuesDecoder.class).instanceSize();

    private final ValuesReader innerReader;

    public BinaryDeltaValuesDecoder(ParquetEncoding encoding, int valueCount, ByteBufferInputStream bufferInputStream)
            throws IOException
    {
        if (encoding == DELTA_BYTE_ARRAY) {
            innerReader = new DeltaByteArrayReader();
        }
        else if (encoding == DELTA_LENGTH_BYTE_ARRAY) {
            innerReader = new DeltaLengthByteArrayValuesReader();
        }
        else {
            throw new IllegalArgumentException("Unsupported encoding: " + encoding);
        }
        innerReader.initFromPage(valueCount, bufferInputStream);
    }

    @Override
    public ValueBuffer readNext(int length)
            throws IOException
    {
        Binary[] values = new Binary[length];
        int bufferSize = 0;
        for (int i = 0; i < length; i++) {
            Binary value = innerReader.readBytes();
            values[i] = value;
            bufferSize += value.length();
        }
        return new DeltaValueBuffer(values, bufferSize);
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Check the column chunk's actual encoding in the file metadata (parquet-tools) and confirm which decoder should be used
  2. If the data is plain-encoded, ensure the code path selects the plain values decoder instead of the delta decoder
  3. Upgrade presto-parquet so new encodings are mapped to the right decoder
  4. If the file is valid but unsupported, rewrite it with a supported encoding

Example fix

// before (upstream routing): encoderSelection -> BinaryDeltaValuesDecoder for PLAIN encoding
// after: dispatch to the matching decoder
// if (encoding == Encoding.PLAIN) { return new BinaryPlainValuesDecoder(...); }
// return new BinaryDeltaValuesDecoder(encoding, valueCount, bufferInputStream);
Defensive patterns

Strategy: type-guard

Validate before calling

// Confirm the column's encoding before expecting delta decoding:
// parquet-tools meta file.parquet | grep <binary column>  # must show DELTA_BINARY_PACKED / DELTA_BYTE_ARRAY / DELTA_LENGTH_BYTE_ARRAY

Type guard

boolean isDeltaBinaryEncoding(org.apache.parquet.schema.PrimitiveType t, Encoding e) {
    return e == Encoding.DELTA_BINARY_PACKED
        || e == Encoding.DELTA_BYTE_ARRAY
        || e == Encoding.DELTA_LENGTH_BYTE_ARRAY;
}

Try / catch

try {
    ValuesDecoder d = new BinaryDeltaValuesDecoder(encoding, valueCount, in);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Unsupported encoding")) {
        // route to the correct decoder for this encoding
    }
    throw e;
}

Prevention

When it happens

Trigger: Constructing BinaryDeltaValuesDecoder for a column chunk whose encoding is none of DELTA_BINARY_PACKED, DELTA_BYTE_ARRAY, or DELTA_LENGTH_BYTE_ARRAY (e.g. PLAIN or a future encoding routed here by mistake).

Common situations: A routing/selection bug upstream sends a PLAIN-encoded binary column to the delta decoder; files written with encodings the reader doesn't map; reader version mismatches where the encoder-selection logic disagrees with the writer.

Related errors


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