prestodb/presto · error · IllegalArgumentException

Unsupported encoding

Error message

Unsupported encoding 

What it means

MapBatchStreamReader.startStripe selects the delegate reader (direct, flat, etc.) based on the stripe's encoding kind. If the kind matches none of the supported DWRF map encodings, it throws IllegalArgumentException('Unsupported encoding ' + kind). The file uses a map column encoding this reader does not implement.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/MapBatchStreamReader.java:84

    {
        return currentReader.readBlock();
    }

    @Override
    public void startStripe(ZoneId timezone, Stripe stripe)
            throws IOException
    {
        ColumnEncodingKind kind = stripe.getColumnEncodings().get(streamDescriptor.getStreamId())
                .getColumnEncoding(streamDescriptor.getSequence())
                .getColumnEncodingKind();
        if (kind == DIRECT || kind == DIRECT_V2 || kind == DWRF_DIRECT) {
            currentReader = directReader;
        }
        else if (kind == DWRF_MAP_FLAT) {
            currentReader = flatReader;
        }
        else {
            throw new IllegalArgumentException("Unsupported encoding " + kind);
        }

        currentReader.startStripe(timezone, stripe);
    }

    @Override
    public void startRowGroup(InputStreamSources dataStreamSources)
            throws IOException
    {
        currentReader.startRowGroup(dataStreamSources);
    }

    @Override
    public String toString()
    {
        return toStringHelper(this)
                .addValue(streamDescriptor)
                .toString();

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Dump the ORC/DWRF footer (orc-tools) to identify the actual encoding kind of the map column.
  2. Upgrade Presto to a version supporting the encoding.
  3. Rewrite the table/file with standard MAP_DIRECT encoding using a compatible writer.
  4. Check that you are not forcing a DWRF reader on a standard ORC file (or vice versa) — use the matching reader factory.
Defensive patterns

Strategy: validation

Validate before calling

ColumnEncodingKind kind = stripe.getColumnEncodings().get(columnId).getKind();
if (!(kind == MAP_DIRECT || kind == MAP_FLAT_DICTIONARY || kind == DWRF_MAP_FLAT)) {
    throw new IllegalArgumentException("Unsupported map encoding kind: " + kind);
}

Type guard

boolean isSupportedMapEncoding(ColumnEncodingKind kind) {
    return kind == MAP_DIRECT || kind == MAP_FLAT_DICTIONARY || kind == DWRF_MAP_FLAT;
}

Try / catch

try {
    reader.startStripe(timezone, stripe);
}
catch (IllegalArgumentException e) {
    throw new PrestoException(ORC_BAD_DATA, "Map column uses unsupported encoding: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Reading a map column whose stripe encoding kind is not MAP_DIRECT, MAP_FLAT_DICTIONARY, or DWRF_MAP_FLAT — e.g. a newer DWRF map encoding from a newer writer, or corrupted footer metadata yielding an unexpected kind.

Common situations: Reading DWRF files written by newer Facebook tooling with an older Presto; files written by third-party engines emitting non-standard map encodings; schema/encoding metadata corruption after partial writes.

Related errors


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