{"record":{"id":"787a427f7b7a265e","repo":"prestodb/presto","slug":"unsupported-native-type-in-set-with-type","errorCode":null,"errorMessage":"Unsupported native type in set:  with type ","messagePattern":"Unsupported native type in set:  with type ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/util/FastutilSetHelper.java","lineNumber":65,"sourceCode":"    {\n        // 0.25 as the load factor is chosen because the argument set is assumed to be small (<10000),\n        // and the return set is assumed to be read-heavy.\n        // The performance of InCodeGenerator heavily depends on the load factor being small.\n        Class<?> javaElementType = type.getJavaType();\n        if (javaElementType == long.class) {\n            return new LongOpenCustomHashSet((Collection<Long>) set, 0.25f, new LongStrategy(functionAndTypeManager, type));\n        }\n        if (javaElementType == double.class) {\n            return new DoubleOpenCustomHashSet((Collection<Double>) set, 0.25f, new DoubleStrategy(functionAndTypeManager, type));\n        }\n        if (javaElementType == boolean.class) {\n            return new BooleanOpenHashSet((Collection<Boolean>) set, 0.25f);\n        }\n        else if (!type.getJavaType().isPrimitive()) {\n            return new ObjectOpenCustomHashSet(set, 0.25f, new ObjectStrategy(functionAndTypeManager, type));\n        }\n        else {\n            throw new UnsupportedOperationException(\"Unsupported native type in set: \" + type.getJavaType() + \" with type \" + type.getTypeSignature());\n        }\n    }\n\n    public static boolean in(boolean booleanValue, BooleanOpenHashSet set)\n    {\n        return set.contains(booleanValue);\n    }\n\n    public static boolean in(double doubleValue, DoubleOpenCustomHashSet set)\n    {\n        return set.contains(doubleValue);\n    }\n\n    public static boolean in(long longValue, LongOpenCustomHashSet set)\n    {\n        return set.contains(longValue);\n    }\n","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/util/FastutilSetHelper.java#L47-L83","documentation":"FastutilSetHelper.toFastutilHashSet converts a Java Set of values into a specialized fastutil hash set chosen by the type's native Java type. Primitive wrappers and non-primitive types are handled, but a primitive Java type that has no dedicated branch (e.g. unexpected primitive binding like byte/short/float) hits this UnsupportedOperationException naming both the Java type and the type signature.","triggerScenarios":"Building an IN-list predicate set during query planning/filter pushdown for a column whose JavaType is a primitive without a dedicated branch — typically byte, short, or float native containers produced by an unusual type binding or a custom type/plugin.","commonSituations":"Custom plugins exposing types with primitive float/byte/short native representations used in IN predicates; Presto version changes altering native container types; dynamic filtering pushing non-standard column types into set construction.","solutions":["Avoid IN predicates on the offending column type, or cast the column/values to a supported type (BIGINT, DOUBLE, VARCHAR, BOOLEAN) so the generic ObjectOpenCustomHashSet path is used","Check the column's declared type with typeof() and whether a connector/plugin maps it to an unusual native type","Upgrade Presto — newer versions add handling for more primitive native types in set compilation","If you own the plugin, change the type's native container type to a boxed/Object representation"],"exampleFix":"-- before\nSELECT * FROM t WHERE tiny_col IN (1, 2, 3); -- unsupported primitive set\n-- after\nSELECT * FROM t WHERE CAST(tiny_col AS BIGINT) IN (1, 2, 3);","handlingStrategy":"type-guard","validationCode":"// before building an IN set\nTypeSignature sig = type.getTypeSignature();\nif (!(type.getJavaType() == long.class || type.getJavaType() == double.class || type.getJavaType() == boolean.class || !type.getJavaType().isPrimitive())) throw new IllegalArgumentException(\"Type not supported in IN set: \" + sig);","typeGuard":"boolean inSetSafe(Type t) { Class<?> j = t.getJavaType(); return !j.isPrimitive() || j == long.class || j == double.class || j == boolean.class; }","tryCatchPattern":"try { Set<?> s = FastutilSetHelper.toFastutilHashSet(set, type, ftm); } catch (UnsupportedOperationException e) { /* fall back to linear-scan IN evaluation or cast the column */ }","preventionTips":["Cast exotic types (tinyint/real on custom plugins) to BIGINT/DOUBLE/VARCHAR before IN predicates","Inspect native container types when writing custom type plugins","Prefer dynamically-supported types for columns used heavily in IN filters and dynamic filtering"],"tags":["presto","type-system","set","unsupported-type"],"backgroundTag":"unsupported-native-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"}