apache/flink · error · IllegalArgumentException

Unsupported Avro type '%s'.

Error message

Unsupported Avro type '%s'.

What it means

The terminal throw of AvroSchemaConverter's type-mapping switch: schema.getType() matched none of the handled Avro types (record, enum, array, map, union, boolean, int, long, float, double, string, bytes, null). Whatever type fell through — e.g. FIXED — is by design not convertible to Flink TypeInformation by this converter, and IllegalArgumentException names it.

Source

Thrown at flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java:226

                    } else if (schema.getLogicalType() == LogicalTypes.localTimestampMillis()
                            || schema.getLogicalType() == LogicalTypes.localTimestampMicros()) {
                        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 string

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Replace FIXED in the schema with BYTES (equivalent for Flink's purposes): {"type":"bytes"} or use bytes with a decimal logicalType.
  2. Pre-normalize third-party schemas before handing them to AvroSchemaConverter.
  3. If decimals are the goal, declare {"type":"bytes","logicalType":"decimal",...} which the converter supports.

Example fix

// before
{"name":"price","type":{"type":"fixed","name":"D128","size":16,"logicalType":"decimal","precision":38,"scale":18}}

// after
{"name":"price","type":{"type":"bytes","logicalType":"decimal","precision":38,"scale":18}}
Defensive patterns

Strategy: validation

Validate before calling

static void validateNoFixed(Schema s) {
    if (s.getType() == Schema.Type.FIXED) {
        throw new IllegalArgumentException("FIXED type unsupported by AvroSchemaConverter: " + s.getName());
    }
    if (s.getType() == Schema.Type.RECORD) {
        s.getFields().forEach(f -> validateNoFixed(f.schema()));
    }
    if (s.getType() == Schema.Type.UNION) s.getTypes().forEach(SchemaValidator::validateNoFixed);
    if (s.getType() == Schema.Type.ARRAY) validateNoFixed(s.getElementType());
    if (s.getType() == Schema.Type.MAP) validateNoFixed(s.getValueType());
}

Prevention

When it happens

Trigger: convertToTypeInfo/convertToDataType over a schema containing a FIXED type (commonly used for decimal or MD5/UUID fields) or another type not covered by the switch.

Common situations: Schemas generated by avro-tools decimal encoding (fixed-length bytes) or other tools that prefer fixed; legacy schemas using fixed for binary blobs.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/a7bcb1b3873d3163. Report an issue: GitHub.