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
- Upgrade Presto to a version supporting the encoding kind in the file
- Rewrite the ORC file with a compatible writer version (e.g. hive.orc.writer.version default) so the column uses DIRECT or DICTIONARY_V2
- Set session hive.orc.use-column-names / writer settings or disable the batch reader path if a config flag controls it
- 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
- Keep Presto upgraded to support newer ORC encodings
- Write ORC files with the stable writer version (hive.orc.writer.version)
- Inspect stripe encodings of external files before ingesting them
- Avoid mixing files from writers with unsupported encoding kinds in one table
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
- nanos field of an encoded timestamp in ORC must be between 0
- seconds field of timestamp exceeds maximum supported value,
- Timestamp exceeds maximum supported value, value: %s truncat
- Unsupported type:
- Value is not null but data stream is not present
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/077b84eb1925ca8a.
Report an issue: GitHub.