apache/iceberg · error · UnsupportedOperationException
Transform is not supported:
Error message
Transform is not supported:
What it means
Thrown when converting a Spark sort expression's transform to an Iceberg term and the transform is not one of the supported set (identity, year/month/day/hour, bucket, truncate, zorder, etc.). The default branch rejects unknown Transform values.
Source
Thrown at spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java:408
return org.apache.iceberg.expressions.Expressions.month(colName);
case "date":
case "day":
case "days":
return org.apache.iceberg.expressions.Expressions.day(colName);
case "date_hour":
case "hour":
case "hours":
return org.apache.iceberg.expressions.Expressions.hour(colName);
case "truncate":
return org.apache.iceberg.expressions.Expressions.truncate(colName, findWidth(transform));
case "zorder":
return new Zorder(
Stream.of(transform.references())
.map(ref -> DOT.join(ref.fieldNames()))
.map(org.apache.iceberg.expressions.Expressions::ref)
.collect(Collectors.toList()));
default:
throw new UnsupportedOperationException("Transform is not supported: " + transform);
}
} else if (expr instanceof NamedReference) {
NamedReference ref = (NamedReference) expr;
return org.apache.iceberg.expressions.Expressions.ref(DOT.join(ref.fieldNames()));
} else {
throw new UnsupportedOperationException("Cannot convert unknown expression: " + expr);
}
}
/**
* Converts Spark transforms into a {@link PartitionSpec}.
*
* @param schema the table schema
* @param partitioning Spark Transforms
* @return a PartitionSpec
*/View on GitHub (pinned to 86d9c8fc54)
Solutions
- Use a supported transform: identity, year, month, day, hour, bucket, truncate, or zorder
- Check the exact transform named in the message and map it to a supported equivalent
- Upgrade Iceberg if the transform is newly standardized in Spark
Example fix
-- before
CREATE TABLE t (id bigint) USING iceberg SORTED BY (date_trunc('week', ts));
-- after
CREATE TABLE t (id bigint) USING iceberg SORTED BY (day(ts)); Defensive patterns
Strategy: validation
Validate before calling
Transform t = ...; Set<String> supported = Set.of("identity","year","month","day","hour","bucket","truncate","zorder"); if (!supported.contains(t.name().toLowerCase(Locale.ROOT))) { throw new IllegalArgumentException("Transform not supported: " + t.name()); } Type guard
boolean isSupportedTransform(Transform<?> t) { return List.of("identity","year","month","day","hour","bucket","truncate","zorder").contains(t.name().toLowerCase(Locale.ROOT)); } Try / catch
try { SortOrder order = Spark3Util.toIcebergTerm(transform, ...); } catch (UnsupportedOperationException e) { LOG.error("Map this transform manually: {}", e.getMessage()); throw e; } Prevention
- Restrict generated DDL to identity/year/month/day/hour/bucket/truncate/zorder transforms
- Validate transform functions in SQL templating before execution
- Keep Iceberg updated when Spark adds new standard transforms
When it happens
Trigger: Using a Spark transform (e.g. unsupported function-based transform) in sort columns or bucketing DDL that Spark3Util.toIcebergTerm translates, with the transform falling into the default case.
Common situations: Custom Spark transforms in CREATE TABLE ... CLUSTERED BY / SORTED BY; Spark upgrades adding new standard transforms; typos in transform functions.
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
- Transform is not supported: ${transform}
- Unable to parse sortOrder: %s
- Cannot find width for transform: %s
- Cannot specify the 'sort-order' because it's a reserved tabl
- Cannot mix identity sort columns and a Zorder sort expressio
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/9259b1d145c75ee8.
Report an issue: GitHub.