{"record":{"id":"9bbd9bd1c993304a","repo":"apache/iceberg","slug":"unsupported-type-primitive-9bbd9b","errorCode":null,"errorMessage":"Unsupported type: ${primitive}","messagePattern":"Unsupported type: (.+?)","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/data/SparkParquetWriters.java","lineNumber":292,"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":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/data/SparkParquetWriters.java#L274-L310","documentation":"The Iceberg Spark Parquet writer throws this when asked to write a physical Parquet primitive type it has no writer mapping for. The exhaustive switch over primitive types covers BOOLEAN/INT32/INT64/FLOAT/DOUBLE/BINARY/FIXED_LEN_BYTE_ARRAY; any other type reaches the default branch and aborts the write.","triggerScenarios":"Writing a Spark DataFrame through Iceberg's Parquet writers when a column maps to a physical Parquet primitive type not present in the writer switch — only reachable via an unusual/legacy Parquet type (e.g. INT96) or a custom schema injection, since normal Spark types map to supported physical types.","commonSituations":"Custom SparkType-to-Parquet mappings in patched builds; forward-ported code where a new Parquet type was added to the enum; writing files intended for systems requiring INT96 timestamps.","solutions":["Ensure all columns are written with standard Parquet types; avoid INT96 and other legacy types in the schema","Upgrade Iceberg to a version whose writer supports the required primitive type","Inspect the generated Parquet schema (schema() on the write builder) and adjust the Spark data types","If support is genuinely missing, convert the column to a supported type before writing"],"exampleFix":"// before: column backed by an unsupported physical type\n// after: cast to a supported type before write\ndf = df.withColumn(\"ts\", col(\"ts\").cast(\"timestamp\")); // standard mapping instead of legacy INT96","handlingStrategy":"validation","validationCode":"// Check the physical schema of the write\nspark.sessionState.catalog; // or:\ntable.schema(); // ensure Spark types map to standard Parquet primitives (no INT96/legacy types)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep Spark column types standard so the physical Parquet mapping is standard","Avoid legacy INT96 configs (spark.sql.parquet.outputTimestampType=INT96)","Upgrade Iceberg before introducing new Parquet physical types"],"tags":["parquet","spark","writer","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"}