prestodb/presto · error · IllegalArgumentException
Unsupported type
Error message
Unsupported type
What it means
TpchMetadata.getPrestoType maps TpchColumnType base types (identifier, integer, date, double, varchar) to Presto types. Any TpchType whose base type is not in the switch falls through to this IllegalArgumentException, meaning the TPCH connector encountered a column type it cannot represent in Presto's type system.
Source
Thrown at presto-tpch/src/main/java/com/facebook/presto/tpch/TpchMetadata.java:552
}
}
public static Type getPrestoType(TpchColumn<?> column)
{
TpchColumnType tpchType = column.getType();
switch (tpchType.getBase()) {
case IDENTIFIER:
return BIGINT;
case INTEGER:
return INTEGER;
case DATE:
return DATE;
case DOUBLE:
return DOUBLE;
case VARCHAR:
return createVarcharType((int) (long) tpchType.getPrecision().get());
}
throw new IllegalArgumentException("Unsupported type " + tpchType);
}
private long calculateTotalRows(int scaleBase, double scaleFactor)
{
double totalRows = scaleBase * scaleFactor;
if (totalRows > Long.MAX_VALUE) {
throw new IllegalArgumentException("Total rows is larger than 2^64");
}
return (long) totalRows;
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Check the TpchType base type being passed and confirm it is one of the supported types (IDENTIFIER, INTEGER, DATE, DOUBLE, VARCHAR).
- Add a case to the switch in getPrestoType mapping the new base type to the corresponding Presto type.
- If a dependency upgrade introduced new TpchColumnType values, update presto-tpch to a version whose switch covers them, or patch the mapping yourself.
Example fix
// before
case VARCHAR:
return createVarcharType((int) (long) tpchType.getPrecision().get());
}
throw new IllegalArgumentException("Unsupported type " + tpchType);
// after
case VARCHAR:
return createVarcharType((int) (long) tpchType.getPrecision().get());
case BIGINT:
return BIGINT;
}
throw new IllegalArgumentException("Unsupported type " + tpchType); Defensive patterns
Strategy: validation
Validate before calling
// Java: check base type before mapping
if (!EnumSet.of(IDENTIFIER, INTEGER, DATE, DOUBLE, VARCHAR).contains(tpchType.getBaseType())) {
throw new IllegalArgumentException("Cannot map TPCH type: " + tpchType);
} Try / catch
try {
prestoType = metadata.getPrestoType(tpchType);
} catch (IllegalArgumentException e) {
// log unsupported type and skip the column/table
log.warn("Skipping unsupported TPCH type: %s", e.getMessage());
} Prevention
- After upgrading the tpch dependency, enumerate TpchColumnType values and confirm the switch covers all of them.
- Add a unit test iterating every TpchColumnType base type through getPrestoType.
- Never construct TpchColumnTypes ad hoc; only use types from TpchTable definitions.
When it happens
Trigger: Calling getPrestoType with a TpchType whose BaseType is not IDENTIFIER, INTEGER, DATE, DOUBLE, or VARCHAR (e.g. a new TpchColumnType enum value added upstream without updating this switch).
Common situations: Upgrading the tpch library/dependency where TpchColumnType gained new base types; custom code constructing TpchColumnTypes directly and passing them through getTableMetadata or toColumnHandle.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/b65d1105ea1c3838.
Report an issue: GitHub.