prestodb/presto · error · PrestoException
ICEBERG_INCOMPATIBLE_COLUMN_TYPE
ICEBERG_INCOMPATIBLE_COLUMN_TYPE
Error message
Failed to set column type:
What it means
Wraps any RuntimeException from the Iceberg schema-update commit when a column's type is changed (ALTER TABLE ... ALTER COLUMN TYPE). The underlying Iceberg updateColumn rejected the type change, typically because the new type is not a promotable primitive type for the existing column.
Source
Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java:2878
private boolean viewExists(ConnectorSession session, ConnectorTableMetadata viewMetadata)
{
return getViewMetadata(session, viewMetadata.getTable()).isPresent();
}
@Override
public void setColumnType(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle, com.facebook.presto.common.type.Type type)
{
IcebergTableHandle table = (IcebergTableHandle) tableHandle;
IcebergColumnHandle column = (IcebergColumnHandle) columnHandle;
Table icebergTable = getIcebergTable(session, table.getSchemaTableName());
try {
icebergTable.updateSchema()
.updateColumn(column.getName(), toIcebergType(type).asPrimitiveType())
.commit();
}
catch (RuntimeException e) {
throw new PrestoException(ICEBERG_INCOMPATIBLE_COLUMN_TYPE, "Failed to set column type: " + firstNonNull(e.getMessage(), e), e);
}
}
protected void openCreateTableTransaction(SchemaTableName tableName, Transaction transaction)
{
transactionContext.registerTransaction(tableName, transaction);
}
/**
* Check and ensure that the specified statement can only run in a transaction with autocommit context set to true.
* */
protected void shouldRunInAutoCommitTransaction(String statement)
{
if (!transactionContext.isAutoCommitContext()) {
throw new PrestoException(ICEBERG_TRANSACTION_CONFLICT_ERROR, statement + " cannot be called within a transaction (use autocommit mode) in Iceberg connector.");
}
}
}View on GitHub (pinned to 55bb57d202)
Solutions
- Only use Iceberg-supported type promotions (e.g. int->long, float->double, decimal precision widening)
- Read the wrapped cause (the last exception in the chain) for the exact schema-update failure reason
- Add a new column, backfill with UPDATE, and drop the old column instead of an in-place type change
- Retry if the failure was a concurrent-commit conflict (ConcurrentModificationException from Iceberg)
Example fix
// before ALTER TABLE t ALTER COLUMN c SET DATA TYPE VARCHAR; -- int -> varchar not promotable // after ALTER TABLE t ADD COLUMN c_str VARCHAR; UPDATE t SET c_str = CAST(c AS VARCHAR); ALTER TABLE t DROP COLUMN c;
Defensive patterns
Strategy: try-catch
Validate before calling
// only attempt Iceberg-promotable widenings
Set<String> promotable = Set.of("integer->bigint","float->double","decimal->decimal(precision,wider scale)");
if (!isPromotable(currentType, newType)) throw new IllegalArgumentException("Unsupported Iceberg type change: " + currentType + " -> " + newType); Try / catch
try { ALTER ... } catch (PrestoException e) { if ("ICEBERG_INCOMPATIBLE_COLUMN_TYPE".equals(e.getErrorCode().getName())) { /* inspect e.getCause() for the schema-commit failure; fall back to add/backfill/drop */ } else throw e; } Prevention
- Only perform Iceberg-supported promotions (int->bigint, float->double, decimal widening)
- Never change primitive families in place; use add-column/backfill/drop-column
- Avoid concurrent schema edits on the same table
- Check nested-field type rules before altering struct/map children
When it happens
Trigger: Calling IcebergAbstractMetadata.setColumnType (ALTER TABLE ... SET COLUMN TYPE) where icebergTable.updateSchema().updateColumn(...).commit() throws, e.g. widening int to varchar, changing a nested field type, or conflicting concurrent schema updates.
Common situations: Attempting unsupported type promotions (int->varchar, timestamp<->timestamptz, decimal precision narrowing), altering columns inside nested structs/maps, or concurrent schema evolution conflicts.
Related errors
- ICEBERG_MISSING_COLUMN
- NOT_SUPPORTED
- NOT_SUPPORTED
- Not a Hive table:
- Not an Iceberg table: ${getSchemaTableName()}
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/85de932e618d09a1.
Report an issue: GitHub.