{"record":{"id":"2264908eee8f5d50","repo":"apache/iceberg","slug":"unsupported-logical-type-s","errorCode":null,"errorMessage":"Unsupported logical type: %s","messagePattern":"Unsupported logical type: (.+?)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/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.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkAvroWriter.java#L126-L162","documentation":"FlinkAvroWriter.primitive() throws IllegalArgumentException 'Unsupported logical type: <type>' when an Iceberg primitive type carries a logical type annotation (e.g. a uuid string logical type) that the Avro writer builder does not recognize. Only a fixed set of logical types (decimal, uuid per some writers) is supported; anything else falls through to the default branch.","triggerScenarios":"Writing an Iceberg table containing a primitive column with an Avro logical-type annotation not handled by the switch (e.g. an unexpected/unknown logical type annotation) to Avro files.","commonSituations":"Tables written by newer Iceberg versions or other engines introducing logical types the Flink v2.1 Avro writer doesn't support; custom type mappings.","solutions":["Check which logical type triggered it from the message and remove/retype the column (e.g. store as string/bytes without the annotation).","Upgrade iceberg-flink to a newer version where the logical type may be supported.","File/consult an issue for adding support for the logical type in FlinkValueWriters.","Convert data before writing: project the table to a schema without the unsupported logical type via TableScan.withProjection or select()."],"exampleFix":"// before\nTypes.NestedField field = Types.NestedField.optional(1, \"id\", Types.UUIDType.get());\n// after (if unsupported by writer version)\nTypes.NestedField field = Types.NestedField.optional(1, \"id\", Types.StringType.get());","handlingStrategy":"validation","validationCode":"schema.columns().forEach(c -> {\n  if (c.type() instanceof Types.UUIDType || hasLogicalAnnotation(c.type())) {\n    // ensure writer version supports it or retype\n  }\n});","typeGuard":"boolean isSupportedPrimitive(Type t) {\n  return t.typeId() == Type.TypeID.BOOLEAN || t.typeId() == Type.TypeID.INTEGER\n    || t.typeId() == Type.TypeID.LONG || t.typeId() == Type.TypeID.FLOAT\n    || t.typeId() == Type.TypeID.DOUBLE || t.typeId() == Type.TypeID.STRING\n    || t.typeId() == Type.TypeID.BINARY || t.typeId() == Type.TypeID.FIXED\n    || t.typeId() == Type.TypeID.DATE || t.typeId() == Type.TypeID.TIMESTAMP\n    || t.typeId() == Type.TypeID.DECIMAL;\n}","tryCatchPattern":"try {\n  writer.write(rowData);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unsupported logical type\")) {\n    throw new IllegalStateException(\"Retype or upgrade writer for: \" + e.getMessage(), e);\n  }\n  throw e;\n}","preventionTips":["Prefer string columns over uuid unless your writer version supports it.","Check the flink writer's supported logical types before adopting new Iceberg types.","Pin schema definitions in one place and validate against writer support."],"tags":["flink","avro","writer","unsupported-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"}