{"record":{"id":"db9fa8156e059f3f","repo":"apache/iceberg","slug":"unsupported-type-db9fa8","errorCode":null,"errorMessage":"Unsupported type: ","messagePattern":"Unsupported type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/data/SparkAvroWriter.java","lineNumber":166,"sourceCode":"            return ValueWriters.tinyints();\n          } else if (type instanceof ShortType) {\n            return ValueWriters.shorts();\n          }\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 SparkValueWriters.strings();\n        case FIXED:\n          return ValueWriters.fixed(primitive.getFixedSize());\n        case BYTES:\n          return ValueWriters.bytes();\n        default:\n          throw new IllegalArgumentException(\"Unsupported type: \" + primitive);\n      }\n    }\n  }\n}\n","sourceCodeStart":148,"sourceCodeEnd":171,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/data/SparkAvroWriter.java#L148-L171","documentation":"SparkAvroWriter.primitive converts Avro primitive types into Iceberg value writers. The switch covers all standard Avro primitives (BOOLEAN, INT, LONG, FLOAT, DOUBLE, STRING, FIXED, BYTES, etc.); the default branch should be unreachable but fires if an unexpected/unrecognized primitive appears. This IllegalArgumentException signals an Avro primitive the writer does not handle.","triggerScenarios":"Writing data whose Avro schema contains a primitive type not covered by the writer's switch (e.g. NULL-type fields surfacing in unusual positions, or corrupted/foreign schema objects passed as Avro primitives).","commonSituations":"Rare in practice: encountered with hand-built or dynamically generated Avro schemas, or when Iceberg's writer is version-mismatched with an Avro library emitting new primitive kinds.","solutions":["Inspect the Avro schema and replace unsupported primitives with standard ones.","Align Avro library versions between your app and Iceberg's dependency set.","Upgrade Iceberg to get a writer covering the primitive.","Pre-convert the data to a supported primitive type before writing."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate all Avro primitives are standard before writing\nSet<org.apache.avro.Schema.Type> standard = EnumSet.of(\n    org.apache.avro.Schema.Type.BOOLEAN, org.apache.avro.Schema.Type.INT,\n    org.apache.avro.Schema.Type.LONG, org.apache.avro.Schema.Type.FLOAT,\n    org.apache.avro.Schema.Type.DOUBLE, org.apache.avro.Schema.Type.STRING,\n    org.apache.avro.Schema.Type.FIXED, org.apache.avro.Schema.Type.BYTES,\n    org.apache.avro.Schema.Type.NULL);\n// walk the schema and assert every leaf type is in `standard`","typeGuard":"static boolean isStandardPrimitive(org.apache.avro.Schema s) {\n  return standard.contains(s.getType());\n}","tryCatchPattern":null,"preventionTips":["Use standard Avro primitive types only","Keep Avro library versions aligned with Iceberg's","Validate dynamically generated schemas before writing"],"tags":["spark","avro","unsupported-type","schema"],"backgroundTag":"unsupported-operation","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"}