{"record":{"id":"9223786ae0558d53","repo":"apache/iceberg","slug":"unsupported-logical-type-922378","errorCode":null,"errorMessage":"Unsupported logical type: ","messagePattern":"Unsupported logical type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkAvroWriter.java","lineNumber":144,"sourceCode":"\n          case \"time-micros\":\n            return FlinkValueWriters.timeMicros();\n\n          case \"timestamp-micros\":\n            return FlinkValueWriters.timestampMicros();\n\n          case \"timestamp-nanos\":\n            return FlinkValueWriters.timestampNanos();\n\n          case \"decimal\":\n            LogicalTypes.Decimal decimal = (LogicalTypes.Decimal) logicalType;\n            return FlinkValueWriters.decimal(decimal.getPrecision(), decimal.getScale());\n\n          case \"uuid\":\n            return FlinkValueWriters.uuids();\n\n          default:\n            throw new IllegalArgumentException(\"Unsupported logical type: \" + logicalType);\n        }\n      }\n\n      switch (primitive.getType()) {\n        case NULL:\n          return ValueWriters.nulls();\n        case BOOLEAN:\n          return ValueWriters.booleans();\n        case INT:\n          switch (type.getTypeRoot()) {\n            case TINYINT:\n              return ValueWriters.tinyints();\n            case SMALLINT:\n              return ValueWriters.shorts();\n            default:\n              return ValueWriters.ints();\n          }\n        case LONG:","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkAvroWriter.java#L126-L162","documentation":"FlinkAvroWriter's visitor throws IllegalArgumentException('Unsupported logical type: ...') when an Avro primitive carries a logical type (e.g. a date/time/decimal-like logicalType string) that the writer has no value writer for.","triggerScenarios":"Writing Flink RowData to Avro where the target Avro field's logicalType attribute is not one of the handled values (date/timestamp-millis/decimal/uuid handled; others hit default).","commonSituations":"Custom Avro schemas with nonstandard logicalType names; Avro schemas produced by other systems using logical types this connector doesn't recognize; schema registry supplied schemas.","solutions":["Change the Avro schema to use a supported logical type (decimal, date, timestamp-millis, uuid) or drop the logicalType attribute.","Add/customize the writer to handle the logical type via FlinkValueWriters.","Normalize the schema before writing (e.g. map unknown logical types to plain primitives)."],"exampleFix":"// before\n{\"name\":\"f\",\"type\":\"long\",\"logicalType\":\"time-micros\"} // unsupported\n// after\n{\"name\":\"f\",\"type\":\"int\",\"logicalType\":\"date\"} // supported logical type","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(\"decimal\",\"date\",\"timestamp-millis\",\"uuid\");\nschema.fields().forEach(f -> {\n  Object lt = f.logicalType();\n  if (lt != null && !supported.contains(lt.toString())) throw new IllegalStateException(\"Unsupported logical type: \" + lt);\n});","typeGuard":"boolean hasSupportedLogicalType(Schema.Field f) { return f.logicalType() == null || SUPPORTED_LOGICALS.contains(f.logicalType().toString()); }","tryCatchPattern":"try { writer.write(rowData); } catch (IllegalArgumentException e) { /* regenerate Avro schema with supported logical types */ }","preventionTips":["Only use standard Avro logical types in supplied schemas","Normalize external schemas before writing","Keep connector updated for new logical type support"],"tags":["flink","avro","logical-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"}