apache/iceberg · error · java.lang.UnsupportedOperationException
Not a supported type:
Error message
Not a supported type:
What it means
This is the fallback branch of SparkTypeToType.atomic: a Spark type reached the converter that has no Iceberg mapping (it is not boolean, numeric, decimal, binary, geometry, geography, or null-type). The UnsupportedOperationException reports the unsupported Spark type's catalogString. It prevents silent mis-typing of Spark data in Iceberg schemas.
Source
Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkTypeToType.java:188
} else if (atomic instanceof GeometryType) {
GeometryType geometry = (GeometryType) atomic;
if (geometry.isMixedSrid()) {
throw new UnsupportedOperationException(
"Cannot convert Spark geometry with mixed SRID to Iceberg");
}
return Types.GeometryType.of(geometry.crs());
} else if (atomic instanceof GeographyType) {
GeographyType geography = (GeographyType) atomic;
if (geography.isMixedSrid()) {
throw new UnsupportedOperationException(
"Cannot convert Spark geography with mixed SRID to Iceberg");
}
return Types.GeographyType.of(geography.crs(), convertAlgorithm(geography.algorithm()));
} else if (atomic instanceof NullType) {
return Types.UnknownType.get();
}
throw new UnsupportedOperationException("Not a supported type: " + atomic.catalogString());
}
// Translates Spark's edge-interpolation algorithm to Iceberg's, mirroring
// TypeToSparkType#convertAlgorithm. Spark supports only the spherical algorithm today; anything
// else is rejected loudly rather than silently defaulting, so a new Spark algorithm surfaces here
// instead of being dropped.
private static EdgeAlgorithm convertAlgorithm(EdgeInterpolationAlgorithm algorithm) {
switch (algorithm.toString().toUpperCase(Locale.ROOT)) {
case "SPHERICAL":
return EdgeAlgorithm.SPHERICAL;
default:
throw new UnsupportedOperationException(
"Iceberg does not support Spark geography edge algorithm: " + algorithm);
}
}
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Upgrade iceberg-spark to a version whose type converter supports the Spark type
- Cast or drop the unsupported column to a supported type (e.g. cast to string/binary) before conversion
- Wrap the offending type in a supported equivalent upstream
- If the type should be supported, file/port support for it in the converter
Example fix
// before
Types.IcebergType t = new SparkTypeToType().convert(sparkTypeWithUnsupportedType); // throws
// after
df = df.drop("unsupportedCol");
Types.IcebergType t = new SparkTypeToType().convert(df.schema()); Defensive patterns
Strategy: type-guard
Validate before calling
boolean convertible = dt instanceof BooleanType || dt instanceof NumericType
|| dt instanceof DecimalType || dt instanceof BinaryType
|| dt instanceof GeometryType || dt instanceof GeographyType || dt instanceof NullType; Type guard
if (!convertible) {
throw new IllegalStateException("Unsupported Spark type for Iceberg: " + dt.catalogString());
} Try / catch
try {
icebergType = converter.convert(sparkSchema);
} catch (UnsupportedOperationException e) {
if (e.getMessage().startsWith("Not a supported type:")) {
// cast/drop the offending column and retry
}
} Prevention
- Keep iceberg-spark versions in lockstep with your Spark version
- Cast exotic types to supported primitives before schema conversion
- Drop plugin-defined types before writing Iceberg schemas
- Check release notes for newly supported Spark types
When it happens
Trigger: Converting a schema containing exotic/unsupported Spark atomic types into an Iceberg Type via SparkTypeToType.convert.
Common situations: Newer Spark types not yet mapped in the Iceberg version in use; custom Spark types from third-party plugins; using an outdated iceberg-spark build against a newer Spark release introducing new types.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Spark does not support time fields
- Cannot convert unsupported type to Spark: ${primitive}
- Spark does not support time fields
- Unsupported type:
- Encountered an unsupported ORC type during a write from Spar
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/58dc6ddf0a3042b1.
Report an issue: GitHub.