{"record":{"id":"902c60d3df3eea95","repo":"apache/iceberg","slug":"not-a-supported-type-atomic-catalogstring-902c60","errorCode":null,"errorMessage":"Not a supported type: ${atomic.catalogString()}","messagePattern":"Not a supported type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkTypeToType.java","lineNumber":169,"sourceCode":"    } else if (atomic instanceof DateType) {\n      return Types.DateType.get();\n\n    } else if (atomic instanceof TimestampType) {\n      return Types.TimestampType.withZone();\n\n    } else if (atomic instanceof TimestampNTZType) {\n      return Types.TimestampType.withoutZone();\n\n    } else if (atomic instanceof DecimalType) {\n      return Types.DecimalType.of(\n          ((DecimalType) atomic).precision(), ((DecimalType) atomic).scale());\n    } else if (atomic instanceof BinaryType) {\n      return Types.BinaryType.get();\n    } else if (atomic instanceof NullType) {\n      return Types.UnknownType.get();\n    }\n\n    throw new UnsupportedOperationException(\"Not a supported type: \" + atomic.catalogString());\n  }\n}\n","sourceCodeStart":151,"sourceCodeEnd":172,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkTypeToType.java#L151-L172","documentation":"SparkTypeToSparkType's type conversion (in SparkTypeToType.java, the fromSparkType atomic branch) falls through to a final throw when the given Spark AtomicType is not one of the recognized Iceberg-mappable atomic types. The library throws UnsupportedOperationException because there is no defined Iceberg type equivalent for that Spark type. It is a fail-fast guard for unsupported type mappings rather than an unexpected internal state.","triggerScenarios":"Calling the Spark-to-Iceberg type conversion on a Spark DataType that is not one of the supported atomic types (BooleanType, integer types, long, float, double, decimal, string, binary, date, timestamp, null); the method reaches the final throw and includes type.catalogString() in the message.","commonSituations":"Reading a Spark table with exotic or newer Spark types (e.g. calendar interval types, char/varchar in some versions, or custom AtomicTypes) and converting its schema to Iceberg; version upgrades introducing Spark types the converter predates.","solutions":["Identify the offending Spark type from the message's catalogString and remove or cast that column from the schema being converted","Upgrade to an Iceberg build that supports the Spark type in question","Pre-transform the Spark schema to replace unsupported types with supported ones (e.g. cast interval/char to string) before conversion","If the type genuinely should be supported, report/patch an extension in SparkTypeToType"],"exampleFix":"// before\nTypes.Type icebergType = SparkTypeToType.convert(sparkSchema); // fails on interval column\n// after\nStructType cleaned = new StructType();\nfor (StructField f : sparkSchema.fields()) {\n  DataType dt = (f.dataType() instanceof CalendarIntervalType) ? DataTypes.StringType : f.dataType();\n  cleaned = cleaned.add(f.name(), dt, f.nullable());\n}\nTypes.Type icebergType = SparkTypeToType.convert(cleaned);","handlingStrategy":"type-guard","validationCode":"import org.apache.spark.sql.types.*;\nstatic boolean isConvertible(DataType t) {\n  return t instanceof BooleanType || t instanceof ByteType || t instanceof ShortType\n      || t instanceof IntegerType || t instanceof LongType || t instanceof FloatType\n      || t instanceof DoubleType || t instanceof DecimalType || t instanceof StringType\n      || t instanceof BinaryType || t instanceof DateType || t instanceof TimestampType\n      || t instanceof NullType;\n}","typeGuard":"if (isConvertible(field.dataType())) { convert(field); } else { log.warn(\"Skipping unsupported column \" + field.name()); }","tryCatchPattern":"try {\n  Types.Type t = SparkTypeToType.convert(sparkType);\n} catch (UnsupportedOperationException e) {\n  // message contains the offending catalogString; handle by skipping/casting the column\n}","preventionTips":["Pre-check every Spark schema field against the supported atomic type list before schema conversion","Cast exotic types (interval, char/varchar, UDTs) to string in a preprocessing step","Keep the Iceberg Spark runtime version aligned with your Spark version"],"tags":["unsupported-operation","spark","type-conversion"],"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"}