apache/iceberg · error · IllegalArgumentException
Unsupported Avro type '${schema.getType()}'.
Error message
Unsupported Avro type '${schema.getType()}'. What it means
The private convertToTypeInfo(Schema, boolean) maps Avro schema types to Flink TypeInformation. Types with no mapping (FIXED, BYTES beyond handled cases, unions, enums, etc. depending on the switch) fall through the switch and hit a final throw of IllegalArgumentException("Unsupported Avro type '<type>'.").
Source
Thrown at flink/v1.20/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
- Rewrite the schema to use only supported types: replace ENUM with STRING, FIXED with fixed-size BYTES equivalent, and unions with nullable wrappers only where the converter supports them.
- Use convertToDataType (the newer DataType API) instead of convertToTypeInfo — it covers more Avro types.
- For unions, restructure the field as nullable single type; for records containing unions, change the source schema or pre-convert the data.
- Check which type failed (in the message) and consult the switch in AvroSchemaConverter for the supported set.
Example fix
// before
Schema enumSchema = Schema.createEnum("Color", null, null, Arrays.asList("RED", "BLUE"));
AvroSchemaConverter.convertToTypeInfo(enumSchema, false); // throws Unsupported Avro type 'ENUM'
// after
Schema strSchema = Schema.create(Schema.Type.STRING);
AvroSchemaConverter.convertToTypeInfo(strSchema, false); // Types.STRING Defensive patterns
Strategy: validation
Validate before calling
static final Set<Schema.Type> SUPPORTED = EnumSet.of(RECORD, ARRAY, MAP, STRING, INT, LONG, FLOAT, DOUBLE, BOOLEAN, NULL);
// walk schema recursively before calling convertToTypeInfo
static void validate(Schema s) {
switch (s.getType()) {
case RECORD: s.getFields().forEach(f -> validate(f.schema())); break;
case ARRAY: validate(s.getElementType()); break;
case MAP: validate(s.getValueType()); break;
default:
if (!SUPPORTED.contains(s.getType())) throw new IllegalStateException("Unsupported: " + s.getType());
}
} Try / catch
try {
AvroSchemaConverter.convertToTypeInfo(schema, false);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unsupported Avro type")) {
// fall back to convertToDataType or rewrite the schema
} else throw e;
} Prevention
- Prefer convertToDataType (newer DataType API) over the legacy TypeInformation path.
- Restrict source schemas to primitives, record, array, map, and [T, null] unions.
- Replace ENUM and FIXED fields with STRING/BYTES at schema-generation time.
When it happens
Trigger: AvroSchemaConverter.convertToTypeInfo(schema, legacyTimestampMapping) where schema.getType() is not one of RECORD/ARRAY/MAP/STRING/INT/LONG/FLOAT/DOUBLE/BOOLEAN/NULL handled by the switch — e.g. UNION, ENUM, FIXED, BYTES.
Common situations: Schemas containing Avro unions (this legacy TypeInformation path doesn't handle them), enums, or logical types; schemas generated by tools that emit ENUM/FIXED by default; passing a top-level non-record schema.
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/2ddbdbe80e0736e2.
Report an issue: GitHub.