{"record":{"id":"b65d1105ea1c3838","repo":"prestodb/presto","slug":"unsupported-type-b65d11","errorCode":null,"errorMessage":"Unsupported type ","messagePattern":"Unsupported type ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-tpch/src/main/java/com/facebook/presto/tpch/TpchMetadata.java","lineNumber":552,"sourceCode":"        }\n    }\n\n    public static Type getPrestoType(TpchColumn<?> column)\n    {\n        TpchColumnType tpchType = column.getType();\n        switch (tpchType.getBase()) {\n            case IDENTIFIER:\n                return BIGINT;\n            case INTEGER:\n                return INTEGER;\n            case DATE:\n                return DATE;\n            case DOUBLE:\n                return DOUBLE;\n            case VARCHAR:\n                return createVarcharType((int) (long) tpchType.getPrecision().get());\n        }\n        throw new IllegalArgumentException(\"Unsupported type \" + tpchType);\n    }\n\n    private long calculateTotalRows(int scaleBase, double scaleFactor)\n    {\n        double totalRows = scaleBase * scaleFactor;\n        if (totalRows > Long.MAX_VALUE) {\n            throw new IllegalArgumentException(\"Total rows is larger than 2^64\");\n        }\n        return (long) totalRows;\n    }\n}\n","sourceCodeStart":534,"sourceCodeEnd":564,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-tpch/src/main/java/com/facebook/presto/tpch/TpchMetadata.java#L534-L564","documentation":"TpchMetadata.getPrestoType maps TpchColumnType base types (identifier, integer, date, double, varchar) to Presto types. Any TpchType whose base type is not in the switch falls through to this IllegalArgumentException, meaning the TPCH connector encountered a column type it cannot represent in Presto's type system.","triggerScenarios":"Calling getPrestoType with a TpchType whose BaseType is not IDENTIFIER, INTEGER, DATE, DOUBLE, or VARCHAR (e.g. a new TpchColumnType enum value added upstream without updating this switch).","commonSituations":"Upgrading the tpch library/dependency where TpchColumnType gained new base types; custom code constructing TpchColumnTypes directly and passing them through getTableMetadata or toColumnHandle.","solutions":["Check the TpchType base type being passed and confirm it is one of the supported types (IDENTIFIER, INTEGER, DATE, DOUBLE, VARCHAR).","Add a case to the switch in getPrestoType mapping the new base type to the corresponding Presto type.","If a dependency upgrade introduced new TpchColumnType values, update presto-tpch to a version whose switch covers them, or patch the mapping yourself."],"exampleFix":"// before\ncase VARCHAR:\n    return createVarcharType((int) (long) tpchType.getPrecision().get());\n}\nthrow new IllegalArgumentException(\"Unsupported type \" + tpchType);\n// after\ncase VARCHAR:\n    return createVarcharType((int) (long) tpchType.getPrecision().get());\ncase BIGINT:\n    return BIGINT;\n}\nthrow new IllegalArgumentException(\"Unsupported type \" + tpchType);","handlingStrategy":"validation","validationCode":"// Java: check base type before mapping\nif (!EnumSet.of(IDENTIFIER, INTEGER, DATE, DOUBLE, VARCHAR).contains(tpchType.getBaseType())) {\n    throw new IllegalArgumentException(\"Cannot map TPCH type: \" + tpchType);\n}","typeGuard":null,"tryCatchPattern":"try {\n    prestoType = metadata.getPrestoType(tpchType);\n} catch (IllegalArgumentException e) {\n    // log unsupported type and skip the column/table\n    log.warn(\"Skipping unsupported TPCH type: %s\", e.getMessage());\n}","preventionTips":["After upgrading the tpch dependency, enumerate TpchColumnType values and confirm the switch covers all of them.","Add a unit test iterating every TpchColumnType base type through getPrestoType.","Never construct TpchColumnTypes ad hoc; only use types from TpchTable definitions."],"tags":["tpch-connector","type-mapping","illegal-argument"],"backgroundTag":"unsupported-type-mapping","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"}