prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Unsupported column type: 

What it means

ClickHousePageSink.appendColumn() binds each column value of an inserted page to the prepared INSERT statement. Only the supported Presto types are handled (setLong/setString/etc.); any other type — notably some TimestampType variants like TIMESTAMP WITH TIME ZONE, or types without a matching branch — throws NOT_SUPPORTED.

Source

Thrown at presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/ClickHousePageSink.java:177

        else if (type instanceof DecimalType) {
            statement.setBigDecimal(parameter, readBigDecimal((DecimalType) type, block, position));
        }
        else if (isVarcharType(type) || isCharType(type)) {
            statement.setString(parameter, type.getSlice(block, position).toStringUtf8());
        }
        else if (VARBINARY.equals(type)) {
            statement.setBytes(parameter, type.getSlice(block, position).getBytes());
        }
        else if (DATE.equals(type)) {
            // convert to midnight in default time zone
            statement.setDate(parameter, convertZonedDaysToDate(type.getLong(block, position)));
        }
        else if (type instanceof TimestampType) {
            // setTimestamp doesn't work, so we use setLong as described at https://github.com/ClickHouse/clickhouse-java/issues/608
            statement.setLong(parameter, type.getLong(block, position));
        }
        else {
            throw new PrestoException(NOT_SUPPORTED, "Unsupported column type: " + type.getDisplayName());
        }
    }

    @Override
    public CompletableFuture<Collection<Slice>> finish()
    {
        // commit and close
        try (Connection connection = this.connection; PreparedStatement statement = this.statement) {
            if (batchSize > 0) {
                statement.executeBatch();
                // ClickHouse JDBC 0.3.2+ throws SQLFeatureNotSupportedException for commit when auto-commit is enabled
                ignoreIfNoTransactionsSupported(connection::commit);
            }
        }
        catch (SQLNonTransientException e) {
            throw new PrestoException(JDBC_NON_TRANSIENT_ERROR, e);
        }
        catch (SQLException e) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Cast unsupported columns before inserting, e.g. CAST(col AS TIMESTAMP)
  2. Alter the ClickHouse table to use supported types
  3. Rewrite the INSERT to only include supported columns
  4. Upgrade the connector if a newer version supports the type

Example fix

// before
INSERT INTO ch.db.t SELECT tz_ts FROM other.catalog.t;
// after
INSERT INTO ch.db.t SELECT CAST(tz_ts AS TIMESTAMP) FROM other.catalog.t;
Defensive patterns

Strategy: validation

Validate before calling

// Validate insert column types before running INSERT into ClickHouse
for (Column c : insertColumns) {
    if (c.getType() instanceof TimeWithTimeZoneType || c.getType().equals(TIME)) {
        throw new IllegalArgumentException("Cannot insert column " + c.getName() + " of type " + c.getType() + " into ClickHouse");
    }
}

Type guard

boolean isClickHouseInsertable(Type t) {
    return t instanceof BooleanType || t instanceof BigintType || t instanceof IntegerType
        || t instanceof SmallintType || t instanceof TinyintType || t instanceof DoubleType
        || t instanceof RealType || t instanceof VarcharType || t instanceof CharType
        || t instanceof DateType || (t instanceof TimestampType && !isTzAware(t));
}

Try / catch

try {
    insertIntoClickHouse(...);
} catch (PrestoException e) {
    if (e.getErrorCode().getCode() == NOT_SUPPORTED.toErrorCode().getCode()
            && e.getMessage().startsWith("Unsupported column type")) {
        // retry with recast column list
    } else throw e;
}

Prevention

When it happens

Trigger: INSERT INTO a ClickHouse table (including INSERT via CTAS or INSERT VALUES) where a column's Presto type has no branch in appendColumn, e.g. timestamp with time zone, time, or other unsupported types.

Common situations: Inserting from tables in other catalogs with types ClickHouse sink cannot encode; schema drift between source and ClickHouse table; writing TIMESTAMP WITH TIME ZONE data.

Understand the failure class

Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.

Related errors


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