apache/iceberg · error · java.lang.IllegalArgumentException
Unsupported Avro type '${schema.getType()}'.
Error message
Unsupported Avro type '${schema.getType()}'. What it means
AvroSchemaConverter.convertToTypeInfo throws this when the Avro schema contains a type the converter has no mapping for when building a Flink TypeInformation (e.g. RECORD handled separately but exotic/unexpected schema kinds fall through the switch). The Avro type name is included in the message.
Source
Thrown at flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/formats/avro/typeutils/AvroSchemaConverter.java:236
|| (schema.getLogicalType() != null
&& schema.getLogicalType().getName().equals("local-timestamp-nanos"))) {
return Types.LOCAL_DATE_TIME;
} else if (schema.getLogicalType() == LogicalTypes.timeMicros()
|| schema.getLogicalType() == LogicalTypes.timeMillis()) {
return Types.SQL_TIME;
}
}
return Types.LONG;
case FLOAT:
return Types.FLOAT;
case DOUBLE:
return Types.DOUBLE;
case BOOLEAN:
return Types.BOOLEAN;
case NULL:
return Types.VOID;
}
throw new IllegalArgumentException("Unsupported Avro type '" + schema.getType() + "'.");
}
/**
* Converts an Avro schema string into a nested row structure with deterministic field order and
* data types that are compatible with Flink's Table & SQL API.
*
* @param avroSchemaString Avro schema definition string
* @return data type matching the schema
*/
public static DataType convertToDataType(String avroSchemaString) {
return convertToDataType(avroSchemaString, true);
}
/**
* Converts an Avro schema string into a nested row structure with deterministic field order and
* data types that are compatible with Flink's Table & SQL API.
*
* @param avroSchemaString Avro schema definition stringView on GitHub (pinned to 86d9c8fc54)
Solutions
- Simplify the schema to supported Avro types (record, primitives, arrays, maps, nullable unions)
- Use convertToDataType (Table API path) which supports a broader type surface than convertToTypeInfo
- Upgrade Iceberg/Flink to a version handling the Avro type
- Pre-transform the schema to replace the unsupported type
Example fix
// before: unsupported union nested type
{"type":["int","long"]}
// after
{"type":"long"} Defensive patterns
Strategy: validation
Validate before calling
Schema s = new Schema.Parser().parse(schemaString);
Set<Schema.Type> supported = EnumSet.of(Schema.Type.RECORD, Schema.Type.ENUM, Schema.Type.ARRAY,
Schema.Type.MAP, Schema.Type.UNION, Schema.Type.FIXED, Schema.Type.STRING, Schema.Type.BOOLEAN,
Schema.Type.INT, Schema.Type.LONG, Schema.Type.FLOAT, Schema.Type.DOUBLE, Schema.Type.BYTES, Schema.Type.NULL);
Deque<Schema> stack = new ArrayDeque<>(List.of(s));
while (!stack.isEmpty()) {
Schema cur = stack.pop();
if (!supported.contains(cur.getType())) throw new IllegalStateException("Unsupported Avro type: " + cur.getType());
cur.getFields().forEach(f -> stack.push(f.schema()));
} Try / catch
try {
TypeInformation<?> ti = AvroSchemaConverter.convertToTypeInfo(schema, false);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unsupported Avro type")) {
// use convertToDataType or transform the schema
} else { throw e; }
} Prevention
- Prefer convertToDataType (Table API) for broader type coverage
- Avoid exotic Avro constructs in schemas destined for TypeInformation conversion
- Upgrade Iceberg when using newer Avro schema features
- Validate nested schema types before conversion
When it happens
Trigger: Converting an Avro schema whose top-level or nested type is not in the handled set (e.g. unexpected schema kind like RECURSIVE sentinel or unsupported wrappers) into TypeInformation.
Common situations: Schemas with unusual constructs (unions at unsupported positions, exotic logical types) passed to the TypeInformation-based (DataSet/DataStream legacy) API; version drift between writer schema features and converter support.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Unsupported Avro type '${schema.getType()}'.
- Unsupported Avro type '" + schema.getType() + "'.
- Unsupported type: variant
- Unsupported type:
- Unsupported type:
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/2ff4a2858e7acfb4.
Report an issue: GitHub.