prestodb/presto · error · SemanticException
TYPE_MISMATCH
TYPE_MISMATCH
Error message
Unknown type '%s' for column '%s'
What it means
CreateTableTask.internalExecute throws SemanticException(TYPE_MISMATCH) when metadata.getType(parseTypeSignature(column.getType())) raises IllegalArgumentException or UnknownTypeException, meaning the declared column type string cannot be parsed or resolved to a registered type in this Presto installation.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/CreateTableTask.java:133
}
ConnectorId connectorId = getConnectorIdOrThrow(session, metadata, tableName.getCatalogName());
LinkedHashMap<String, ColumnMetadata> columns = new LinkedHashMap<>();
Map<String, Object> inheritedProperties = ImmutableMap.of();
boolean includingProperties = false;
List<TableConstraint<String>> constraints = new ArrayList<>();
for (TableElement element : statement.getElements()) {
if (element instanceof ColumnDefinition) {
ColumnDefinition column = (ColumnDefinition) element;
String columnName = column.getName().getValue();
String name = metadata.normalizeIdentifier(session, tableName.getCatalogName(), columnName);
Type type;
try {
type = metadata.getType(parseTypeSignature(column.getType()));
}
catch (IllegalArgumentException | UnknownTypeException e) {
throw new SemanticException(TYPE_MISMATCH, element, "Unknown type '%s' for column '%s'", column.getType(), column.getName());
}
if (type.equals(UNKNOWN)) {
throw new SemanticException(TYPE_MISMATCH, element, "Unknown type '%s' for column '%s'", column.getType(), column.getName());
}
if (columns.containsKey(name)) {
throw new SemanticException(DUPLICATE_COLUMN_NAME, column, "Column name '%s' specified more than once", column.getName());
}
if (!column.isNullable() && !metadata.getConnectorCapabilities(session, connectorId).contains(NOT_NULL_COLUMN_CONSTRAINT)) {
throw new SemanticException(NOT_SUPPORTED, column, "Catalog '%s' does not support non-null column for column name '%s'", connectorId.getCatalogName(), column.getName());
}
Map<String, Expression> sqlProperties = mapFromProperties(column.getProperties());
Map<String, Object> columnProperties = metadata.getColumnPropertyManager().getProperties(
connectorId,
tableName.getCatalogName(),
sqlProperties,
session,
metadata,View on GitHub (pinned to 55bb57d202)
Solutions
- Fix the column type name to a supported Presto type (verify against SHOW TYPES / docs for your version).
- Install/enable the plugin or connector that provides the custom type.
- Upgrade Presto if the type exists only in newer releases.
- Map the foreign-engine type to an equivalent Presto type in the DDL.
Example fix
-- before CREATE TABLE t (id INTERGR, ts DATETIME); -- after CREATE TABLE t (id INTEGER, ts TIMESTAMP);
Defensive patterns
Strategy: validation
Validate before calling
try {
Type t = metadata.getType(parseTypeSignature(column.getType()));
if (t == null || t.equals.UNKNOWN) {
throw new IllegalArgumentException("Unresolvable type: " + column.getType());
}
} catch (IllegalArgumentException | UnknownTypeException e) {
throw new IllegalStateException("Fix column type before DDL: " + column.getName());
} Type guard
boolean isKnownColumnType(Metadata metadata, String typeString) {
try {
return !metadata.getType(parseTypeSignature(typeString)).equals(UNKNOWN);
} catch (IllegalArgumentException | UnknownTypeException e) {
return false;
}
} Try / catch
try {
createTable(session, statement, parameters);
} catch (SemanticException e) {
if (e.getCode() == TYPE_MISMATCH && e.getMessage().startsWith("Unknown type")) {
// surface the offending column/type to the caller for correction
} else {
throw e;
}
} Prevention
- Validate column types against SHOW TYPES / metadata.getType before submitting DDL
- Keep a whitelist of types supported by your Presto version and connectors
- Avoid pasting DDL verbatim from other SQL engines
- Pin Presto/plugin versions so type availability is deterministic
When it happens
Trigger: CREATE TABLE with a column whose type name is misspelled, connector-specific, or from a plugin that is not installed, so parseTypeSignature/metadata.getType fails.
Common situations: Typos in DDL (e.g. INTERGR, TIMESTAM); types only available in newer Presto versions; connector-specific types when the target catalog lacks the plugin; pasted DDL from other engines (e.g. MySQL-specific types).
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/36c73471af54b1f7.
Report an issue: GitHub.