prestodb/presto · error · IllegalArgumentException

Unsupported encoding

Error message

Unsupported encoding 

What it means

SliceBatchStreamReader.startStripe dispatches to a slice (string/binary) reader based on the column encoding kind. If the encoding is not one of the supported slice encodings, it throws IllegalArgumentException. This indicates the file's column encoding is incompatible with the slice batch reader.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/SliceBatchStreamReader.java:106

        ColumnEncodingKind columnEncodingKind = stripe.getColumnEncodings().get(streamDescriptor.getStreamId())
                .getColumnEncoding(streamDescriptor.getSequence())
                .getColumnEncodingKind();
        if (columnEncodingKind == DIRECT || columnEncodingKind == DIRECT_V2 || columnEncodingKind == DWRF_DIRECT) {
            currentReader = directReader;
            if (dictionaryReader != null && resetAllReaders) {
                dictionaryReader.startStripe(timezone, stripe);
                System.setProperty("RESET_SLICE_BATCH_READER", "RESET_SLICE_BATCH_READER");
            }
        }
        else if (columnEncodingKind == DICTIONARY || columnEncodingKind == DICTIONARY_V2) {
            currentReader = dictionaryReader;
            if (directReader != null && resetAllReaders) {
                directReader.startStripe(timezone, stripe);
                System.setProperty("RESET_SLICE_BATCH_READER", "RESET_SLICE_BATCH_READER");
            }
        }
        else {
            throw new IllegalArgumentException("Unsupported encoding " + columnEncodingKind);
        }

        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-orc to a version supporting the encoding
  2. Rewrite the file with standard DIRECT or DICTIONARY string encodings
  3. Verify the reader matches the column's actual ORC type and encoding
  4. Inspect the file footer/stripe metadata to identify the unexpected encoding

Example fix

// before
throw new IllegalArgumentException("Unsupported encoding " + columnEncodingKind);
// after
throw new OrcCorruptionException(descriptor.getOrcDataSourceId(), "Unsupported slice encoding %s in %s", columnEncodingKind, descriptor.getStreamName());
Defensive patterns

Strategy: validation

Validate before calling

ColumnEncodingKind kind = stripe.getColumnEncoding(columnId).getColumnEncodingKind(); if (!supportedSliceEncodings.contains(kind)) { throw new IllegalArgumentException("Unsupported slice encoding: " + kind); }

Type guard

boolean isSupportedSliceEncoding(ColumnEncodingKind k) { return k == DIRECT || k == DIRECT_V2 || k == DICTIONARY || k == DWRF_DIRECT; }

Try / catch

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

Prevention

When it happens

Trigger: startStripe encountering a columnEncodingKind outside the supported set for slice columns (e.g., dictionary/direct variants not implemented, or a non-slice encoding due to corrupt metadata).

Common situations: Files written by newer/other engines with encodings this reader doesn't know; corrupt stripe metadata; wrong reader chosen for the column type.

Related errors


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