{"record":{"id":"1ffcad7bfb6b7157","repo":"prestodb/presto","slug":"not-supported-1ffcad","errorCode":"NOT_SUPPORTED","errorMessage":"Unsupported column type: ","messagePattern":"Unsupported column type: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/ClickHousePageSink.java","lineNumber":177,"sourceCode":"        else if (type instanceof DecimalType) {\n            statement.setBigDecimal(parameter, readBigDecimal((DecimalType) type, block, position));\n        }\n        else if (isVarcharType(type) || isCharType(type)) {\n            statement.setString(parameter, type.getSlice(block, position).toStringUtf8());\n        }\n        else if (VARBINARY.equals(type)) {\n            statement.setBytes(parameter, type.getSlice(block, position).getBytes());\n        }\n        else if (DATE.equals(type)) {\n            // convert to midnight in default time zone\n            statement.setDate(parameter, convertZonedDaysToDate(type.getLong(block, position)));\n        }\n        else if (type instanceof TimestampType) {\n            // setTimestamp doesn't work, so we use setLong as described at https://github.com/ClickHouse/clickhouse-java/issues/608\n            statement.setLong(parameter, type.getLong(block, position));\n        }\n        else {\n            throw new PrestoException(NOT_SUPPORTED, \"Unsupported column type: \" + type.getDisplayName());\n        }\n    }\n\n    @Override\n    public CompletableFuture<Collection<Slice>> finish()\n    {\n        // commit and close\n        try (Connection connection = this.connection; PreparedStatement statement = this.statement) {\n            if (batchSize > 0) {\n                statement.executeBatch();\n                // ClickHouse JDBC 0.3.2+ throws SQLFeatureNotSupportedException for commit when auto-commit is enabled\n                ignoreIfNoTransactionsSupported(connection::commit);\n            }\n        }\n        catch (SQLNonTransientException e) {\n            throw new PrestoException(JDBC_NON_TRANSIENT_ERROR, e);\n        }\n        catch (SQLException e) {","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/ClickHousePageSink.java#L159-L195","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Cast unsupported columns before inserting, e.g. CAST(col AS TIMESTAMP)","Alter the ClickHouse table to use supported types","Rewrite the INSERT to only include supported columns","Upgrade the connector if a newer version supports the type"],"exampleFix":"// before\nINSERT INTO ch.db.t SELECT tz_ts FROM other.catalog.t;\n// after\nINSERT INTO ch.db.t SELECT CAST(tz_ts AS TIMESTAMP) FROM other.catalog.t;","handlingStrategy":"validation","validationCode":"// Validate insert column types before running INSERT into ClickHouse\nfor (Column c : insertColumns) {\n    if (c.getType() instanceof TimeWithTimeZoneType || c.getType().equals(TIME)) {\n        throw new IllegalArgumentException(\"Cannot insert column \" + c.getName() + \" of type \" + c.getType() + \" into ClickHouse\");\n    }\n}","typeGuard":"boolean isClickHouseInsertable(Type t) {\n    return t instanceof BooleanType || t instanceof BigintType || t instanceof IntegerType\n        || t instanceof SmallintType || t instanceof TinyintType || t instanceof DoubleType\n        || t instanceof RealType || t instanceof VarcharType || t instanceof CharType\n        || t instanceof DateType || (t instanceof TimestampType && !isTzAware(t));\n}","tryCatchPattern":"try {\n    insertIntoClickHouse(...);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getCode() == NOT_SUPPORTED.toErrorCode().getCode()\n            && e.getMessage().startsWith(\"Unsupported column type\")) {\n        // retry with recast column list\n    } else throw e;\n}","preventionTips":["Cast timestamps-with-time-zone to TIMESTAMP before inserting","Keep source and ClickHouse table schemas aligned","Test insert pipelines with all column types present","Avoid writing unsupported types from cross-catalog INSERTs"],"tags":["write-path","type-mapping","not-supported","insert"],"backgroundTag":"unsupported-column-type","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}