prestodb/presto · error · UnsupportedOperationException
Type not supported as partition column:
Error message
Type not supported as partition column:
What it means
IcebergPageSink.getIcebergValue converts a Presto column value into the plain Java value Iceberg uses to key a partition. It supports the scalar Iceberg-writable types (bigint, int/smallint/tinyint, date, boolean, decimal, real, double, varbinary, varchar, timestamp, time); anything else (e.g. maps, arrays, rows, or other complex types used as partition columns) hits the final throw. The library throws this because Iceberg partition values must be simple comparable primitives that can be written into the partition metadata path.
Source
Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSink.java:556
if (type instanceof DoubleType) {
return type.getDouble(block, position);
}
if (type instanceof VarbinaryType) {
return type.getSlice(block, position).getBytes();
}
if (type instanceof VarcharType) {
return type.getSlice(block, position).toStringUtf8();
}
if (type instanceof TimestampType) {
// Iceberg expects epoch-microseconds. toEpochMicros converts both TIMESTAMP (p=3, millis)
// and TIMESTAMP_MICROSECONDS (p=6, micros) to the required unit.
return ((TimestampType) type).toEpochMicros(type.getLong(block, position));
}
if (type instanceof TimeType) {
long time = type.getLong(block, position);
return MILLISECONDS.toMicros(time);
}
throw new UnsupportedOperationException("Type not supported as partition column: " + type.getDisplayName());
}
public static Object adjustTimestampForPartitionTransform(SqlFunctionProperties functionProperties, Type type, Object value)
{
if (type instanceof TimestampType && functionProperties.isLegacyTimestamp()) {
long timestampValue = (long) value;
TimestampType timestampType = (TimestampType) type;
Instant instant = Instant.ofEpochSecond(timestampType.getEpochSecond(timestampValue),
timestampType.getNanos(timestampValue));
LocalDateTime localDateTime = instant
.atZone(ZoneId.of(functionProperties.getTimeZoneKey().getId()))
.toLocalDateTime();
return timestampType.fromEpochComponents(localDateTime.toEpochSecond(ZoneOffset.UTC), localDateTime.getNano());
}
return value;
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Inspect the table partition spec and remove or replace the unsupported partition column/transform with one of the supported scalar types (bigint, int, boolean, decimal, float, double, string, uuid, binary, date, time, timestamp).
- Recreate the table with a supported partition spec (e.g. PARTITIONED BY day(ts) or bucket(...)) instead of the unsupported expression.
- Upgrade Presto/iceberg connector to a version that supports the transform in question, since support is added over time.
- If the column is not meant to be a partition column, fix the table definition so it is a regular column rather than part of the spec.
Example fix
-- before CREATE TABLE t (payload array(bigint), event date) WITH (partition_by = ARRAY['payload']); -- after CREATE TABLE t (payload array(bigint), event date) WITH (partition_by = ARRAY['event']);
Defensive patterns
Strategy: validation
Validate before calling
-- Check partition column types before writing to an Iceberg table SELECT column_name, data_type FROM information_schema.columns WHERE table_schema = 'myschema' AND table_name = 't' AND column_name IN (SELECT ... -- partition columns from SHOW CREATE TABLE output); -- Only scalar types (bigint, integer, smallint, tinyint, date, boolean, -- decimal, real, double, varbinary, varchar, timestamp, time) are writable partition columns.
Try / catch
BEGIN INSERT INTO iceberg_table ...; EXCEPTION WHEN OTHERS THEN -- surfaces as GENERIC_INTERNAL_ERROR wrapping UnsupportedOperationException -- check message 'Type not supported as partition column: <type>' ROLLBACK; RAISE NOTICE 'Unsupported partition column type; fix partition spec'; END;
Prevention
- Only use supported scalar types as partition columns (avoid array/map/row partition keys).
- Use Iceberg transforms (bucket, truncate, year/month/day/hour) on scalar source columns instead of partitioning on complex types.
- Run SHOW CREATE TABLE to review the partition spec before writing.
- Keep the Presto Iceberg connector up to date so newly supported transforms are available.
When it happens
Trigger: Writing (INSERT/CREATE TABLE AS) into an Iceberg table whose PartitionSpec contains a partition field whose transformed result type is not one of the supported scalar types; getPartitionData calls getIcebergValue for each partition column per row and falls through all instanceof branches.
Common situations: Schema evolution or a custom/unsupported partition transform (e.g. a transform producing a complex type) leaves a partition column with a type like array/row/map; a metastore was populated outside Presto with an exotic partition spec; a Presto version lacks support for a newly added Iceberg partition transform.
Related errors
- ICEBERG_INVALID_PARTITION_VALUE
- GENERIC_INTERNAL_ERROR
- Unsupported partition transform:
- NOT_SUPPORTED
- NOT_SUPPORTED
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/955d56f348ededa8.
Report an issue: GitHub.