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

  1. 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).
  2. Recreate the table with a supported partition spec (e.g. PARTITIONED BY day(ts) or bucket(...)) instead of the unsupported expression.
  3. Upgrade Presto/iceberg connector to a version that supports the transform in question, since support is added over time.
  4. 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

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


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/955d56f348ededa8. Report an issue: GitHub.