{"record":{"id":"5c24e9b0f58983cb","repo":"apache/iceberg","slug":"unsupported-type-primitive-5c24e9","errorCode":null,"errorMessage":"Unsupported type: {primitive}","messagePattern":"Unsupported type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/SparkParquetWriters.java","lineNumber":328,"sourceCode":"                        \"Unsupported logical type: \" + primitive.getLogicalTypeAnnotation()));\n      }\n\n      switch (primitive.getPrimitiveTypeName()) {\n        case FIXED_LEN_BYTE_ARRAY:\n        case BINARY:\n          return byteArrays(desc);\n        case BOOLEAN:\n          return ParquetValueWriters.booleans(desc);\n        case INT32:\n          return ints(sType, desc);\n        case INT64:\n          return ParquetValueWriters.longs(desc);\n        case FLOAT:\n          return ParquetValueWriters.floats(desc);\n        case DOUBLE:\n          return ParquetValueWriters.doubles(desc);\n        default:\n          throw new UnsupportedOperationException(\"Unsupported type: \" + primitive);\n      }\n    }\n  }\n\n  private static PrimitiveWriter<?> ints(DataType type, ColumnDescriptor desc) {\n    if (type instanceof ByteType) {\n      return ParquetValueWriters.tinyints(desc);\n    } else if (type instanceof ShortType) {\n      return ParquetValueWriters.shorts(desc);\n    }\n    return ParquetValueWriters.ints(desc);\n  }\n\n  private static PrimitiveWriter<UTF8String> utf8Strings(ColumnDescriptor desc) {\n    return new UTF8StringWriter(desc);\n  }\n\n  private static PrimitiveWriter<UTF8String> uuids(ColumnDescriptor desc) {","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/SparkParquetWriters.java#L310-L346","documentation":"SparkParquetWriters.primitive maps Spark/ Iceberg primitive types to Parquet writers; only known physical types (INT32/INT64/FLOAT/DOUBLE/etc.) are handled. The default branch throws UnsupportedOperationException when a column's Parquet primitive type has no matching writer.","triggerScenarios":"Writing data where a column descriptor's Parquet primitive type is not one of the types handled in the switch — usually from a schema mapping that produced an exotic physical type (e.g. certain fixed-byte or binary cases unhandled by this writer path).","commonSituations":"Schema evolution producing unexpected physical layouts; using an older Iceberg Spark writer with newer Iceberg types (e.g. uuid, variant) not mapped in this version.","solutions":["Upgrade the iceberg-spark module to match your table spec version so new types have writers.","Exclude or retype unsupported columns (e.g. cast to string) before writing.","Inspect the generated Parquet schema (write.parquet) to confirm which column maps to the unsupported primitive."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before writing, confirm every Iceberg type in the schema has a Parquet writer mapping in your Iceberg version\nschema.columns().forEach(c -> Preconditions.checkArgument(\n    !c.type().equals(Types.UUID.get()), // example: type absent in old writers\n    \"Type %s may not be writable with this iceberg-spark version\", c.type()));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match table format-version features to the iceberg-spark release in use","Avoid newer Iceberg types (uuid, variant) until your writer version supports them","Run a small write test after schema evolution"],"tags":["spark","parquet","write","unsupported-type"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}