{"record":{"id":"5338154f0828c311","repo":"apache/iceberg","slug":"unsupported-type-primitive-533815","errorCode":null,"errorMessage":"Unsupported type: ${primitive}","messagePattern":"Unsupported type: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/data/FlinkPlannedAvroReader.java","lineNumber":192,"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":174,"sourceCodeEnd":197,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/data/FlinkPlannedAvroReader.java#L174-L197","documentation":"FlinkPlannedAvroReader.primitive() switches on the Avro primitive type; NULL, BOOLEAN, INT, LONG, FLOAT, DOUBLE, STRING, FIXED, BYTES, ENUM are handled, and anything else reaches the default, throwing IllegalArgumentException 'Unsupported type'.","triggerScenarios":"An Avro schema whose primitive resolves to a type outside the handled set - typically complex/nested types leaking into the primitive path (e.g. RECORD, ARRAY, MAP, UNION) due to a schema-mapping bug, or unusual Avro type variants.","commonSituations":"Producer schema evolved to a type the reader wasn't built for; schema reconciliation bugs where a projected field is typed differently than planned; reading files with non-standard Avro encodings.","solutions":["Compare the file's Avro schema with the expected read schema and align the producer so only supported primitives reach this path.","Upgrade Iceberg so the reader covers the type, or read the data with a compatible reader version.","Rebuild the read schema (FlinkPlannedAvroReader.create) from the actual file schema instead of a stale projection.","Convert the offending field to a supported type in the upstream pipeline."],"exampleFix":"// before: expected INT but the file schema has a nested record for column 'v'\n// after: align schemas so 'v' is an int, or rebuild the reader from the actual schema\nFlinkPlannedAvroReader.create(readSchema, predicate); // recreated from actual file schema","handlingStrategy":"validation","validationCode":"for (Field f : avroSchema.getFields()) {\n  Schema.Type t = f.schema().getType();\n  if (!EnumSet.of(BOOLEAN, INT, LONG, FLOAT, DOUBLE, STRING, BYTES, FIXED, ENUM, NULL, UNION).contains(t)) {\n    throw new IllegalArgumentException(\"unsupported avro type: \" + t);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  reader = FlinkPlannedAvroReader.create(readSchema, predicate);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unsupported type:\")) {\n    readSchema = alignSchemaWithFile(fileSchema); // rebuild from actual schema\n  }\n}","preventionTips":["Always build read schemas from the actual file schema, not stale projections","Keep producer and consumer schemas versioned together","Test schema evolution paths"],"tags":["flink","avro","unsupported-type"],"backgroundTag":"incompatible-source-type","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"}