prestodb/presto · error · IllegalArgumentException

Unsupported encoding

Error message

Unsupported encoding 

What it means

LongBatchStreamReader.startStripe only supports the encodings it initialized readers for (direct and dictionary). When a stripe's column encoding kind is anything else, it throws IllegalArgumentException("Unsupported encoding " + kind). This indicates the ORC file uses an encoding this batch reader cannot decode.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/reader/LongBatchStreamReader.java:93

        ColumnEncodingKind kind = stripe.getColumnEncodings().get(streamDescriptor.getStreamId())
                .getColumnEncoding(streamDescriptor.getSequence())
                .getColumnEncodingKind();
        if (kind == DIRECT || kind == DIRECT_V2 || kind == DWRF_DIRECT) {
            currentReader = directReader;
            if (dictionaryReader != null && resetAllReaders) {
                dictionaryReader.startStripe(timezone, stripe);
                System.setProperty("RESET_LONG_BATCH_READER", "RESET_LONG_BATCH_READER");
            }
        }
        else if (kind == DICTIONARY) {
            currentReader = dictionaryReader;
            if (directReader != null && resetAllReaders) {
                directReader.startStripe(timezone, stripe);
                System.setProperty("RESET_LONG_BATCH_READER", "RESET_LONG_BATCH_READER");
            }
        }
        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 to a version supporting the encoding kind in the file
  2. Rewrite the ORC file with a compatible writer version (e.g. hive.orc.writer.version default) so the column uses DIRECT or DICTIONARY_V2
  3. Set session hive.orc.use-column-names / writer settings or disable the batch reader path if a config flag controls it
  4. Inspect the file's stripe encodings with orc-tools (java -jar orc-tools meta file.orc) to confirm which kind appears

Example fix

-- before
SET SESSION hive.orc_writer_version = 'UNSTABLE';
-- after
SET SESSION hive.orc_writer_version = 'stable'; -- rewrite data with supported encodings
Defensive patterns

Strategy: try-catch

Validate before calling

// Before querying, inspect file encodings with orc-tools:
// java -jar orc-tools-*.jar meta data.orc | grep encoding

Try / catch

try { reader.startStripe(timezone, stripe); } catch (IllegalArgumentException e) { throw new PrestoException(NOT_SUPPORTED, "ORC encoding not supported: " + e.getMessage() + "; rewrite the file with a compatible writer"); }

Prevention

When it happens

Trigger: startStripe is called with a ColumnEncoding whose kind is not DIRECT/DIRECT_V2/DICTIONARY_V2 (e.g. map-dictionary or future encodings) for a BIGINT/INTEGER-type column read through the batch reader path.

Common situations: Reading ORC files written by newer writers or other engines (Hive 4, newer writer versions) that emit encodings unsupported by this Presto version; misconfigured ORC writer version; synthetic/test data forcing an unknown kind.

Related errors


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