apache/iceberg · error · UnsupportedOperationException
Not a supported type: ${atomic.catalogString()}
Error message
Not a supported type: ${atomic.catalogString()} What it means
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.
Source
Thrown at spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkTypeToType.java:169
} else if (atomic instanceof DateType) {
return Types.DateType.get();
} else if (atomic instanceof TimestampType) {
return Types.TimestampType.withZone();
} else if (atomic instanceof TimestampNTZType) {
return Types.TimestampType.withoutZone();
} else if (atomic instanceof DecimalType) {
return Types.DecimalType.of(
((DecimalType) atomic).precision(), ((DecimalType) atomic).scale());
} else if (atomic instanceof BinaryType) {
return Types.BinaryType.get();
} else if (atomic instanceof NullType) {
return Types.UnknownType.get();
}
throw new UnsupportedOperationException("Not a supported type: " + atomic.catalogString());
}
}
View on GitHub (pinned to 86d9c8fc54)
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
Example fix
// before
Types.Type icebergType = SparkTypeToType.convert(sparkSchema); // fails on interval column
// after
StructType cleaned = new StructType();
for (StructField f : sparkSchema.fields()) {
DataType dt = (f.dataType() instanceof CalendarIntervalType) ? DataTypes.StringType : f.dataType();
cleaned = cleaned.add(f.name(), dt, f.nullable());
}
Types.Type icebergType = SparkTypeToType.convert(cleaned); Defensive patterns
Strategy: type-guard
Validate before calling
import org.apache.spark.sql.types.*;
static boolean isConvertible(DataType t) {
return t instanceof BooleanType || t instanceof ByteType || t instanceof ShortType
|| t instanceof IntegerType || t instanceof LongType || t instanceof FloatType
|| t instanceof DoubleType || t instanceof DecimalType || t instanceof StringType
|| t instanceof BinaryType || t instanceof DateType || t instanceof TimestampType
|| t instanceof NullType;
} Type guard
if (isConvertible(field.dataType())) { convert(field); } else { log.warn("Skipping unsupported column " + field.name()); } Try / catch
try {
Types.Type t = SparkTypeToType.convert(sparkType);
} catch (UnsupportedOperationException e) {
// message contains the offending catalogString; handle by skipping/casting the column
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Not a supported type: type
- Not a supported type: ${type}
- Unsupported element type:
- Cannot apply unknown table change: ${change}
- SparkCachedTableCatalog does not support altering tables
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/902c60d3df3eea95.
Report an issue: GitHub.