{"record":{"id":"8f243e931c1312fc","repo":"apache/iceberg","slug":"unsupported-type-primitive-8f243e","errorCode":null,"errorMessage":"Unsupported type: ${primitive}","messagePattern":"Unsupported type: (.+?)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkPlannedAvroReader.java","lineNumber":198,"sourceCode":"        case LONG:\n          return ValueReaders.longs();\n        case FLOAT:\n          if (partner != null && partner.typeId() == Type.TypeID.DOUBLE) {\n            return ValueReaders.floatsAsDoubles();\n          }\n          return ValueReaders.floats();\n        case DOUBLE:\n          return ValueReaders.doubles();\n        case STRING:\n          return FlinkValueReaders.strings();\n        case FIXED:\n          return ValueReaders.fixed(primitive.getFixedSize());\n        case BYTES:\n          return ValueReaders.bytes();\n        case ENUM:\n          return FlinkValueReaders.enums(primitive.getEnumSymbols());\n        default:\n          throw new IllegalArgumentException(\"Unsupported type: \" + primitive);\n      }\n    }\n  }\n}\n","sourceCodeStart":180,"sourceCodeEnd":203,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkPlannedAvroReader.java#L180-L203","documentation":"FlinkPlannedAvroReader.primitive falls through to a default branch that rejects Avro primitive types it cannot map to a Flink value reader (anything beyond NULL/BOOLEAN/INT/LONG/FLOAT/DOUBLE/FIXED/BYTES/ENUM — e.g. STRING/MAP handled elsewhere, but RECORD/UNION reaching here is invalid). This IllegalArgumentException signals an unexpected or unsupported Avro primitive in the reader's visit path.","triggerScenarios":"Constructing a Flink value reader for an Avro Schema whose primitive type hits the default branch — e.g. an unexpected primitive enum value or a schema shape that routes an unsupported type into primitive().","commonSituations":"Malformed or hand-crafted Avro schemas; schema registry returning incompatible schemas; Avro library version introducing new primitive kinds not yet mapped.","solutions":["Inspect the Avro schema of the file/stream and confirm only supported primitive types are used","Normalize the schema in the producer (avoid exotic/unusual types at this position)","Upgrade Iceberg; if a valid Avro type is rejected, file an issue or extend FlinkPlannedAvroReader"],"exampleFix":"// before\nSchema bad = Schema.create(Schema.Type.STRING); // routed into primitive() unexpectedly\n// after: ensure string fields are handled by the string reader path\nSchema ok = Schema.create(Schema.Type.BYTES);","handlingStrategy":"validation","validationCode":"Set<Schema.Type> ok = Set.of(Schema.Type.BOOLEAN, Schema.Type.INT, Schema.Type.LONG, Schema.Type.FLOAT, Schema.Type.DOUBLE, Schema.Type.FIXED, Schema.Type.BYTES, Schema.Type.ENUM, Schema.Type.NULL);\nif (!ok.contains(primitive.getType())) throw new IllegalArgumentException(\"Unsupported Avro primitive: \" + primitive.getType());","typeGuard":"boolean isSupportedPrimitive(Schema s) { return Set.of(Schema.Type.BOOLEAN, Schema.Type.INT, Schema.Type.LONG, Schema.Type.FLOAT, Schema.Type.DOUBLE, Schema.Type.FIXED, Schema.Type.BYTES, Schema.Type.ENUM, Schema.Type.NULL).contains(s.getType()); }","tryCatchPattern":"try { ... } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unsupported type: \")) { /* inspect primitive, adjust schema */ } else throw e; }","preventionTips":["Validate Avro schemas before ingestion","Avoid exotic/unusual Avro types in tables read by Iceberg","Pin Avro library versions and test schema evolution"],"tags":["avro","flink","unsupported-type"],"backgroundTag":"unsupported-enum-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}