{"record":{"id":"4f0c30c86e4c249f","repo":"prestodb/presto","slug":"unsupported-java-type-s","errorCode":null,"errorMessage":"Unsupported java type %s","messagePattern":"Unsupported java type (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/ClickHouseRecordCursor.java","lineNumber":84,"sourceCode":"            ReadMapping readMapping = clickHouseClient.toPrestoType(columnHandles.get(i).getClickHouseTypeHandle())\n                    .orElseThrow(() -> new VerifyException(\"Unsupported column type\"));\n            Class<?> javaType = readMapping.getType().getJavaType();\n            ReadFunction readFunction = readMapping.getReadFunction();\n\n            if (javaType == boolean.class) {\n                booleanReadFunctions[i] = (BooleanReadFunction) readFunction;\n            }\n            else if (javaType == double.class) {\n                doubleReadFunctions[i] = (DoubleReadFunction) readFunction;\n            }\n            else if (javaType == long.class) {\n                longReadFunctions[i] = (LongReadFunction) readFunction;\n            }\n            else if (javaType == Slice.class) {\n                sliceReadFunctions[i] = (SliceReadFunction) readFunction;\n            }\n            else {\n                throw new IllegalStateException(format(\"Unsupported java type %s\", javaType));\n            }\n        }\n\n        try {\n            connection = clickHouseClient.getConnection(ClickHouseIdentity.from(session), split);\n            statement = clickHouseClient.buildSql(session, connection, split, columnHandles);\n            log.debug(\"Executing: %s\", statement.toString());\n            resultSet = statement.executeQuery();\n        }\n        catch (SQLException | RuntimeException e) {\n            throw handleSqlException(e);\n        }\n    }\n\n    @Override\n    public long getReadTimeNanos()\n    {\n        return 0;","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/ClickHouseRecordCursor.java#L66-L102","documentation":"ClickHouseRecordCursor constructor assigns each column's read function by the function's Java return type (long, boolean, double, Slice, or block). If a registered read function's javaType is none of these it throws IllegalStateException \"Unsupported java type %s\". This is an internal invariant violation — a read function was registered with an unexpected Java representation.","triggerScenarios":"Querying ClickHouse columns whose type's read function returns a Java type outside {long, boolean, double, Slice, Block}; usually after a connector/plugin version mismatch where type registration and read functions disagree.","commonSituations":"Deploying a mismatched Presto server vs plugin build; custom/patched type support; newly added Presto types not handled by the ClickHouse reader.","solutions":["Ensure the presto-clickhouse plugin version exactly matches the Presto server version","Redeploy/restore a clean plugin build if the deployment was patched","Avoid querying columns whose types were added by custom patches","Report/upgrade: this indicates a connector bug for that type"],"exampleFix":"// before (deployment)\nplugin dir contains presto-clickhouse-0.273.jar on a 0.284 server\n// after\nreplace plugin jar with presto-clickhouse-0.284.jar matching the server","handlingStrategy":"try-catch","validationCode":"// Verify plugin jar version matches server before deploying\nString serverVersion = prestoServerVersion;\nString pluginVersion = jarName(\"presto-clickhouse-*.jar\");\nif (!pluginVersion.endsWith(serverVersion + \".jar\")) {\n    throw new IllegalStateException(\"presto-clickhouse plugin \" + pluginVersion + \" mismatches server \" + serverVersion);\n}","typeGuard":null,"tryCatchPattern":"try {\n    runQuery(...);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Unsupported java type\")) {\n        // redeploy matching plugin build / exclude the offending column\n    } else throw e;\n}","preventionTips":["Always ship plugin jars matching the server build","Avoid custom type patches without matching read functions","Smoke-test all column types after upgrades","Pin deployments to tested server+plugin version pairs"],"tags":["internal-error","read-path","version-mismatch","type-system"],"backgroundTag":"version-mismatch","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"}