{"record":{"id":"4cfaf6002b3549c3","repo":"prestodb/presto","slug":"not-supported-4cfaf6","errorCode":"NOT_SUPPORTED","errorMessage":"Unsupported column type: ${type.displayName}","messagePattern":"Unsupported column type: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"presto-base-jdbc/src/main/java/com/facebook/presto/plugin/jdbc/JdbcPageSink.java","lineNumber":144,"sourceCode":"        WriteFunction writeFunction = columnWriters.get(channel);\n        if (javaType == boolean.class) {\n            ((BooleanWriteFunction) writeFunction).set(statement, parameter, type.getBoolean(block, position));\n        }\n        else if (javaType == long.class) {\n            ((LongWriteFunction) writeFunction).set(statement, parameter, type.getLong(block, position));\n        }\n        else if (javaType == double.class) {\n            ((DoubleWriteFunction) writeFunction).set(statement, parameter, type.getDouble(block, position));\n        }\n        else if (javaType == Slice.class) {\n            ((SliceWriteFunction) writeFunction).set(statement, parameter, type.getSlice(block, position));\n        }\n        else {\n            try {\n                ((ObjectWriteFunction) writeFunction).set(statement, parameter, type.getObject(block, position));\n            }\n            catch (SQLException e) {\n                throw new PrestoException(NOT_SUPPORTED, \"Unsupported column type: \" + type.getDisplayName());\n            }\n        }\n    }\n\n    @Override\n    public CompletableFuture<Collection<Slice>> finish()\n    {\n        // commit and close\n        try (Connection connection = this.connection;\n                PreparedStatement statement = this.statement) {\n            if (batchSize > 0) {\n                statement.executeBatch();\n                connection.commit();\n            }\n        }\n        catch (SQLNonTransientException e) {\n            throw new PrestoException(JDBC_NON_TRANSIENT_ERROR, e);\n        }","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-base-jdbc/src/main/java/com/facebook/presto/plugin/jdbc/JdbcPageSink.java#L126-L162","documentation":"The JDBC connector's page sink sets each column value on the prepared INSERT statement via a type-specific ObjectWriteFunction. If setting the value throws a SQLException, the connector concludes the underlying JDBC driver cannot handle Presto's column type and wraps it in a NOT_SUPPORTED PrestoException with the type's display name. It means the JDBC driver rejected the value binding for that column type.","triggerScenarios":"Calling appendPage on a JdbcPageSink where a column's Presto type (e.g. a custom or exotic type like JSON, IPADDRESS, HyperLogLog, or an unsupported mapping) has no write function accepted by the target database's driver; PreparedStatement.setObject fails with SQLException for that parameter.","commonSituations":"Inserting into a JDBC table whose schema maps a Presto type the remote driver can't accept (e.g. writing time/timestamp with unusual precision, arrays, maps into databases like MySQL/PostgreSQL with older drivers); custom JDBC connectors with incomplete type mappings.","solutions":["Check the Presto column type in the error message and cast unsupported columns to a supported type in your INSERT query (e.g. CAST(col AS varchar))","Verify the JDBC driver version is current; upgrade the driver jar so it supports setObject for the type","Check the connector's TypeHandlers/JdbcTypeHandle mapping and register an additional type handler for the type in a custom connector","Avoid writing columns with unsupported types: create a view excluding them or use a different sink"],"exampleFix":"// before\nINSERT INTO jdbc_table SELECT ip_col, hll_col FROM source;\n// after\nINSERT INTO jdbc_table SELECT CAST(ip_col AS varchar), CAST(hll_col AS varchar) FROM source;","handlingStrategy":"try-catch","validationCode":"// Check column types before writing\nfor (int i = 0; i < types.size(); i++) {\n    String name = types.get(i).getDisplayName();\n    if (name.equals(\"json\") || name.equals(\"HyperLogLog\") || name.equals(\"IPaddress\") || name.equals(\"array\") || name.equals(\"map\")) {\n        throw new IllegalArgumentException(\"Column \" + i + \" type \" + name + \" may be unsupported by the JDBC sink; CAST it first\");\n    }\n}","typeGuard":"private static boolean isSupportedColumnType(Type type) {\n    String name = type.getDisplayName();\n    return name.startsWith(\"varchar\") || name.startsWith(\"integer\") || name.startsWith(\"bigint\")\n        || name.startsWith(\"double\") || name.startsWith(\"boolean\") || name.startsWith(\"date\")\n        || name.startsWith(\"timestamp\");\n}","tryCatchPattern":"try {\n    sink.appendPage(page);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getCode() == StandardErrorCode.NOT_SUPPORTED.toErrorCode().getCode()\n            && e.getMessage().startsWith(\"Unsupported column type:\")) {\n        // cast offending column to varchar/bigint and retry\n    } else {\n        throw e;\n    }\n}","preventionTips":["CAST Presto-specific types (json, IPaddress, HyperLogLog, arrays, maps) to varchar/bigint before inserting via JDBC","Keep the target database JDBC driver up to date","Inspect the connector's type mapping documentation before choosing column types","Test INSERTs against staging tables with the same schema before production writes"],"tags":["jdbc","not-supported","type-mapping","sql"],"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-12T02:17:10.037Z"}