{"record":{"id":"94b9d695affb326d","repo":"apache/flink","slug":"unsupported-type-94b9d6","errorCode":null,"errorMessage":"Unsupported type: {}","messagePattern":"Unsupported type: (.+?)","errorType":"validation","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroToVariantDataConverters.java","lineNumber":161,"sourceCode":"                return createMapConverter(valueConverter);\n\n            case UNION:\n                // Handle nullable types (union with null)\n                List<Schema> nonNullUnionType =\n                        schema.getTypes().stream()\n                                .filter(t -> t.getType() != Schema.Type.NULL)\n                                .collect(Collectors.toList());\n\n                if (nonNullUnionType.size() == 1) {\n                    return createNullableConverter(nonNullUnionType.get(0));\n                } else {\n                    throw new UnsupportedOperationException(\n                            \"Avro Union with NULL type is only supported. Unsupported types: \"\n                                    + schema.getTypes());\n                }\n\n            default:\n                throw new UnsupportedOperationException(\"Unsupported type: \" + schema.getType());\n        }\n    }\n\n    /** Creates an array converter that works directly with Avro elements. */\n    private static AvroToVariantDataConverter createArrayConverter(\n            AvroToVariantDataConverter elementConverter) {\n        return (avroObject) -> {\n            List<?> list = (List<?>) avroObject;\n            VariantBuilder.VariantArrayBuilder variantArrayBuilder = SHARED_BUILDER.array();\n\n            for (Object item : list) {\n                Variant convertedItem = elementConverter.convert(item);\n                variantArrayBuilder.add(convertedItem);\n            }\n\n            return variantArrayBuilder.build();\n        };\n    }","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroToVariantDataConverters.java#L143-L179","documentation":"The default branch of AvroToVariantDataConverters.createConverter: the Avro Schema.Type has no Variant converter. The switch covers primitives, records, arrays, maps, and unions; anything else (e.g. FIXED, or enum depending on coverage) throws UnsupportedOperationException with the schema type name.","triggerScenarios":"Converting to VARIANT an Avro schema containing a schema type with no case in this converter's switch (e.g. fixed bytes or enum, per current coverage).","commonSituations":"Feeding Avro schemas with fixed(16) fields (UUIDs, hashes, decimal) or enum fields into the Variant conversion path; assuming all Avro types are Variant-compatible.","solutions":["Replace the unsupported construct in the schema: fixed -> bytes, enum -> string, before conversion.","Pre-process the schema/data with a mapper that normalizes exotic types, then convert to Variant.","Track/patch flink-avro for the missing type support if it is a type the Variant spec allows."],"exampleFix":"// before\n{\"name\":\"id\",\"type\":{\"type\":\"fixed\",\"name\":\"Id16\",\"size\":16}}\n\n// after\n{\"name\":\"id\",\"type\":\"bytes\"}","handlingStrategy":"validation","validationCode":"static void validateVariantConvertible(Schema s) {\n    Schema.Type t = s.getType();\n    if (t == Schema.Type.FIXED) {\n        throw new IllegalArgumentException(\"FIXED not convertible to VARIANT: \" + s.getName());\n    }\n    s.getFields().forEach(f -> validateVariantConvertible(f.schema())); // recurse records\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-check schemas for exotic Avro types (fixed, and any not in the converter switch) before Variant ingestion.","Prefer bytes over fixed in producer schemas."],"tags":["avro","flink","variant","unsupported-type","fixed"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}