prestodb/presto · error · IllegalArgumentException
Unsupported type:
Error message
Unsupported type:
What it means
OrcMetadataWriter.toTypeKind() maps internal TypeKind values to ORC protobuf Type.Kind when writing ORC metadata. If an internal type kind has no case in the switch (e.g. a newly added type not yet mapped), it throws IllegalArgumentException("Unsupported type: ..."). It is an exhaustiveness guard for type serialization.
Source
Thrown at presto-orc/src/main/java/com/facebook/presto/orc/metadata/OrcMetadataWriter.java:208
case CHAR:
return OrcProto.Type.Kind.CHAR;
case BINARY:
return OrcProto.Type.Kind.BINARY;
case DATE:
return OrcProto.Type.Kind.DATE;
case TIMESTAMP:
case TIMESTAMP_MICROSECONDS:
return OrcProto.Type.Kind.TIMESTAMP;
case LIST:
return OrcProto.Type.Kind.LIST;
case MAP:
return OrcProto.Type.Kind.MAP;
case STRUCT:
return OrcProto.Type.Kind.STRUCT;
case UNION:
return OrcProto.Type.Kind.UNION;
}
throw new IllegalArgumentException("Unsupported type: " + orcTypeKind);
}
private static List<OrcProto.StringPair> toStringPairList(Map<String, String> attributes)
{
return attributes.entrySet().stream()
.map(entry -> OrcProto.StringPair.newBuilder()
.setKey(entry.getKey())
.setValue(entry.getValue())
.build())
.collect(toImmutableList());
}
private static OrcProto.ColumnStatistics toColumnStatistics(ColumnStatistics columnStatistics)
{
OrcProto.ColumnStatistics.Builder builder = OrcProto.ColumnStatistics.newBuilder();
if (columnStatistics.hasNumberOfValues()) {
builder.setNumberOfValues(columnStatistics.getNumberOfValues());View on GitHub (pinned to 55bb57d202)
Solutions
- Remove or replace the unsupported type in the table/schema being written
- Upgrade presto-orc so toTypeKind covers the type kind
- Check the message suffix for the exact orcTypeKind value and map it in toTypeKind() if maintaining a fork
Example fix
// before TypeKind kind = type.getTypeKind(); // e.g. newly added JSON kind writerBuilder.setType(...); // throws IllegalArgumentException // after checkArgument(EnumSet.of(BOOLEAN, LONG, DOUBLE, STRING, LIST, MAP, STRUCT, UNION).contains(kind), "Unsupported ORC type: %s", kind);
Defensive patterns
Strategy: validation
Validate before calling
// Validate schema types before writing ORC
private static final Set<TypeKind> SUPPORTED = EnumSet.allOf(TypeKind.class); // keep in sync with toTypeKind
for (ColumnHandle col : columns) {
checkArgument(SUPPORTED.contains(typeKind(col)), "Type not writable to ORC: %s", col);
} Type guard
boolean isWritableToOrc(Type t) {
return !(t instanceof UnknownType) && orcdMappedKinds.contains(t.getTypeKind());
} Try / catch
try {
writer.appendRow(...);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Unsupported type:")) {
throw new IllegalStateException("Schema contains a type the ORC writer cannot serialize: " + e.getMessage(), e);
}
throw e;
} Prevention
- Restrict ORC tables to types with known ORC mappings
- Upgrade writers before adding new types to schemas
- Test CTAS/INSERT for new column types before rollout
When it happens
Trigger: Writing an ORC file whose schema contains a TypeKind not covered by the switch, invoked from builder() during schema serialization.
Common situations: Using a Presto type that maps to a newer internal TypeKind than the writer supports; custom type plugins; version mismatch between type system and ORC writer.
Related errors
- Unsupported type:
- BIGQUERY_UNSUPPORTED_COLUMN_TYPE
- Unsupported type:
- Unsupported native type in set: with type
- Unsupported stream kind:
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/aca5ea58b3e275b4.
Report an issue: GitHub.