prestodb/presto · error · IllegalArgumentException

Unsupported encoding

Error message

Unsupported encoding 

What it means

startStripe in MapSelectiveStreamReader only recognizes DIRECT, DIRECT_V2, DWRF_DIRECT, and DWRF_MAP_FLAT column encodings. Any other encoding kind for a map column throws IllegalArgumentException. It indicates an encoding the map selective reader cannot handle.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/MapSelectiveStreamReader.java:94

    @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) {
            if (flatReader == null) {
                throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Flat map reader does not support nesting " + streamDescriptor);
            }
            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. Upgrade Presto/presto-orc to a version that knows the encoding
  2. Rewrite the file with standard DIRECT/DWRF_DIRECT map encodings
  3. Validate the file's column encodings before reading
  4. Check for writer/reader version mismatch in your deployment

Example fix

// before
throw new IllegalArgumentException("Unsupported encoding " + kind);
// after
throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Unsupported map encoding %s in %s", kind, streamDescriptor);
Defensive patterns

Strategy: validation

Validate before calling

Set<ColumnEncodingKind> supported = EnumSet.of(DIRECT, DIRECT_V2, DWRF_DIRECT, DWRF_MAP_FLAT); if (!supported.contains(kind)) { throw new IllegalArgumentException("Map encoding not supported: " + kind); }

Type guard

boolean isSupportedMapEncoding(ColumnEncodingKind k) { return k == DIRECT || k == DIRECT_V2 || k == DWRF_DIRECT || k == DWRF_MAP_FLAT; }

Try / catch

try { reader.startStripe(timezone, stripe); } catch (IllegalArgumentException e) { throw new UnsupportedFileFormatException("Map encoding unsupported by this Presto version: " + e.getMessage(), e); }

Prevention

When it happens

Trigger: Reading a stripe whose map column encoding kind is something outside the supported set (e.g., a future/unknown DWRF encoding kind) hitting startStripe.

Common situations: Files produced by newer writers with encodings unknown to this reader version; corrupt footer metadata encoding values.

Related errors


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