prestodb/presto · error · PrestoException
NUMERIC_VALUE_OUT_OF_RANGE
NUMERIC_VALUE_OUT_OF_RANGE
Error message
Value out of range: '%s' ('%sB') What it means
parse_data_size(text) parses strings like '10GB' into a byte count. When the computed byte value exceeds what can be encoded as a BIGINT, the ArithmeticException from encoding is rethrown as NUMERIC_VALUE_OUT_OF_RANGE showing both the input and the byte total.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/scalar/DataSizeFunctions.java:66
valueLength++;
}
else {
break;
}
}
if (valueLength == 0) {
throw invalidDataSize(dataSize);
}
BigDecimal value = parseValue(dataSize.substring(0, valueLength), dataSize);
Unit unit = Unit.parse(dataSize.substring(valueLength), dataSize);
BigInteger bytes = value.multiply(unit.getFactor()).toBigInteger();
try {
return encodeUnscaledValue(bytes);
}
catch (ArithmeticException e) {
throw new PrestoException(NUMERIC_VALUE_OUT_OF_RANGE, format("Value out of range: '%s' ('%sB')", dataSize, bytes));
}
}
private static BigDecimal parseValue(String value, String dataSize)
{
try {
return new BigDecimal(value);
}
catch (NumberFormatException e) {
throw invalidDataSize(dataSize);
}
}
private static PrestoException invalidDataSize(String dataSize)
{
return new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid data size: '%s'", dataSize));
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Reduce the value or use a smaller unit so the result fits in BIGINT (< ~9.22EB total bytes)
- Validate the input against a max size before parsing
- Catch the NUMERIC_VALUE_OUT_OF_RANGE condition in callers and surface a clear config error
Example fix
// before
SELECT parse_data_size('10EB'); -- overflows bigint
// after
SELECT parse_data_size('9EB'); -- fits in bigint
Defensive patterns
Strategy: validation
Validate before calling
if (bytes > Long.MAX_VALUE) throw new IllegalArgumentException("out of range"); Prevention
- Bound size strings below ~9.22EB
When it happens
Trigger: parse_data_size('10EB')-style inputs where value * unit factor overflows the maximum BIGINT (about 9.2 exabytes), or huge numeric parts like '99999999999999999999B'.
Common situations: Parsing user/config-provided size strings without bounds (e.g. quota settings typed as '1000000PB'); unit confusion between decimal and binary units in oversized specs.
Related errors
- GENERIC_INTERNAL_ERROR
- INVALID_FUNCTION_ARGUMENT
- INVALID_FUNCTION_ARGUMENT
- NOT_SUPPORTED
- NUMERIC_VALUE_OUT_OF_RANGE
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/db9934ad5d501d29.
Report an issue: GitHub.