prestodb/presto · error · UnsupportedOperationException
Unsupported native type in set: with type
Error message
Unsupported native type in set: with type
What it means
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.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/util/FastutilSetHelper.java:65
{
// 0.25 as the load factor is chosen because the argument set is assumed to be small (<10000),
// and the return set is assumed to be read-heavy.
// The performance of InCodeGenerator heavily depends on the load factor being small.
Class<?> javaElementType = type.getJavaType();
if (javaElementType == long.class) {
return new LongOpenCustomHashSet((Collection<Long>) set, 0.25f, new LongStrategy(functionAndTypeManager, type));
}
if (javaElementType == double.class) {
return new DoubleOpenCustomHashSet((Collection<Double>) set, 0.25f, new DoubleStrategy(functionAndTypeManager, type));
}
if (javaElementType == boolean.class) {
return new BooleanOpenHashSet((Collection<Boolean>) set, 0.25f);
}
else if (!type.getJavaType().isPrimitive()) {
return new ObjectOpenCustomHashSet(set, 0.25f, new ObjectStrategy(functionAndTypeManager, type));
}
else {
throw new UnsupportedOperationException("Unsupported native type in set: " + type.getJavaType() + " with type " + type.getTypeSignature());
}
}
public static boolean in(boolean booleanValue, BooleanOpenHashSet set)
{
return set.contains(booleanValue);
}
public static boolean in(double doubleValue, DoubleOpenCustomHashSet set)
{
return set.contains(doubleValue);
}
public static boolean in(long longValue, LongOpenCustomHashSet set)
{
return set.contains(longValue);
}
View on GitHub (pinned to 55bb57d202)
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
Example fix
-- before SELECT * FROM t WHERE tiny_col IN (1, 2, 3); -- unsupported primitive set -- after SELECT * FROM t WHERE CAST(tiny_col AS BIGINT) IN (1, 2, 3);
Defensive patterns
Strategy: type-guard
Validate before calling
// before building an IN set
TypeSignature sig = type.getTypeSignature();
if (!(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); Type guard
boolean inSetSafe(Type t) { Class<?> j = t.getJavaType(); return !j.isPrimitive() || j == long.class || j == double.class || j == boolean.class; } Try / catch
try { Set<?> s = FastutilSetHelper.toFastutilHashSet(set, type, ftm); } catch (UnsupportedOperationException e) { /* fall back to linear-scan IN evaluation or cast the column */ } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- NOT_SUPPORTED
- NOT_SUPPORTED
- BIGQUERY_UNSUPPORTED_COLUMN_TYPE
- CHAR length scale must be in range [0, %s]
- Enum definition expected, got %s
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/787a427f7b7a265e.
Report an issue: GitHub.