prestodb/presto · error · IllegalArgumentException
Value class %s does not match required Type class %s
Error message
Value class %s does not match required Type class %s
What it means
AllOrNoneValueSet represents a ValueSet that is either all values or none. containsValue(Object) validates that the supplied value's runtime class matches the Java type of the set's Type before returning the all/none answer, throwing IllegalArgumentException on mismatch (note: the format string also has a bug printing the wrapper class instead of type.getJavaType().getName()).
Source
Thrown at presto-common/src/main/java/com/facebook/presto/common/predicate/AllOrNoneValueSet.java:90
}
@Override
public boolean isSingleValue()
{
return false;
}
@Override
public Object getSingleValue()
{
throw new UnsupportedOperationException();
}
@Override
public boolean containsValue(Object value)
{
if (!Primitives.wrap(type.getJavaType()).isInstance(value)) {
throw new IllegalArgumentException(String.format("Value class %s does not match required Type class %s", value.getClass().getName(), Primitives.wrap(type.getJavaType()).getClass().getName()));
}
return all;
}
public AllOrNone getAllOrNone()
{
return () -> all;
}
@Override
public ValuesProcessor getValuesProcessor()
{
return new ValuesProcessor()
{
@Override
public <T> T transform(Function<Ranges, T> rangesFunction, Function<DiscreteValues, T> valuesFunction, Function<AllOrNone, T> allOrNoneFunction)
{
return allOrNoneFunction.apply(getAllOrNone());View on GitHub (pinned to 55bb57d202)
Solutions
- Coerce the value to the domain's Type before calling containsValue (e.g. use type.getObject/Long/Integer accessors appropriate to the type)
- Verify the Type of the Domain/ValueSet matches the column type producing the value
- Box correctly: pass java.lang.Integer for INTEGER, not Long
- If you own the message path, fix the format arg to type.getJavaType().getName() for a clearer error
Example fix
// before boolean contained = allOrNoneSet.containsValue(longValue); // set type is INTEGER // after Integer boxed = ((Long) longValue).intValue(); boolean contained = allOrNoneSet.containsValue(boxed); // matches type.getJavaType()
Defensive patterns
Strategy: validation
Validate before calling
if (!Primitives.wrap(type.getJavaType()).isInstance(value)) {
throw new IllegalArgumentException("value " + value + " not of " + type.getJavaType());
}
boolean contained = valueSet.containsValue(value); Type guard
boolean matchesType(Type type, Object value) { return Primitives.wrap(type.getJavaType()).isInstance(value); } Try / catch
try { return set.containsValue(v); } catch (IllegalArgumentException e) { log.warn("type mismatch: " + e.getMessage()); return false; } Prevention
- Box values with the exact Java class of the Type (Integer for INTEGER, Long for BIGINT)
- Coerce values via the Type API before predicate evaluation
- Keep partition-value types in sync with declared column types
When it happens
Trigger: Calling containsValue(value) on an AllOrNoneValueSet with an object whose class is not assignable to the boxed Java type of the set's Type, e.g. passing a Long to an INTEGER (Integer) typed set, or a String to a BIGINT set.
Common situations: Unboxing/auto-boxing mistakes when evaluating predicates on partition values; connector code passing raw column values without coercing to the domain's type; type changes between metadata lookup and value evaluation (e.g. VARCHAR vs INT partition keys).
Related errors
- Invalid array block:
- Type must be a DecimalType for DecimalVector
- Expected TimestampType but got {type.getClass().getName()}
- Expected VarcharType but got {type.getClass().getName()}
- Expected DateType but got {type.getClass().getName()}
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/8b20e28711a3c7ff.
Report an issue: GitHub.