{"record":{"id":"6aae020e85525b71","repo":"apache/iceberg","slug":"unsupported-logical-type-6aae02","errorCode":null,"errorMessage":"Unsupported logical type: ","messagePattern":"Unsupported logical type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/data/avro/DataWriter.java","lineNumber":141,"sourceCode":"              return GenericWriters.timestamptz();\n            }\n            return GenericWriters.timestamps();\n\n          case \"timestamp-nanos\":\n            if (AvroSchemaUtil.isTimestamptz(primitive)) {\n              return GenericWriters.timestamptzNanos();\n            }\n            return GenericWriters.timestampNanos();\n\n          case \"decimal\":\n            LogicalTypes.Decimal decimal = (LogicalTypes.Decimal) logicalType;\n            return ValueWriters.decimal(decimal.getPrecision(), decimal.getScale());\n\n          case \"uuid\":\n            return ValueWriters.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          return ValueWriters.ints();\n        case LONG:\n          return ValueWriters.longs();\n        case FLOAT:\n          return ValueWriters.floats();\n        case DOUBLE:\n          return ValueWriters.doubles();\n        case STRING:\n          return ValueWriters.strings();","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/data/avro/DataWriter.java#L123-L159","documentation":"DataWriter maps Avro primitive schemas with logical types (decimal, uuid) to Iceberg ValueWriters; when it sees a logical type name it does not handle, this IllegalArgumentException is thrown listing nothing extra — just the logicalType string. Primitive types without logical types fall through to the normal switch below.","triggerScenarios":"Writing Avro data with a primitive schema carrying a logical type other than decimal or uuid (e.g. time-millis, timestamp-micros, or a custom logical type).","commonSituations":"Foreign Avro files with timestamp/timedelta logical types being written through the Iceberg generic writer; custom Avro logical types from other systems.","solutions":["Convert the field to a supported type (decimal or uuid) before writing","Handle unsupported logical types upstream by stripping the logical type or converting values to an Iceberg-supported primitive","Extend the writer with a mapping if the logical type maps naturally to an Iceberg type (e.g. timestamp)"],"exampleFix":"// before\n// schema: {\"type\":\"int\",\"logicalType\":\"time-millis\"} passed to DataWriter\n// after\n// convert value to the target Iceberg type first, e.g. TimeType written via TimeMicrosWriter\nlong micros = TimeUnit.MILLISECONDS.toMicros(millisOfDay);","handlingStrategy":"validation","validationCode":"LogicalType lt = schema.getLogicalType();\nString name = lt != null ? lt.getName() : null;\nif (name != null && !\"decimal\".equals(name) && !\"uuid\".equals(name)) throw new IllegalStateException(\"unsupported logical type: \" + name);","typeGuard":"boolean supportedLogicalType(Schema s) { Object lt = s.getLogicalType(); return lt == null || lt instanceof LogicalTypes.Decimal || \"uuid\".equals(lt.getName()); }","tryCatchPattern":"try { DataWriter.write(encoder, schema, value); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unsupported logical type\")) { /* convert upstream */ } else throw e; }","preventionTips":["Convert foreign Avro logical types before writing through the generic writer","Restrict input schemas to decimal/uuid logical types","Document accepted schema shapes for ingestion pipelines"],"tags":["avro","logical-type","write"],"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"}