prestodb/presto · error · PrestoException
HUDI_INVALID_PARTITION_VALUE
HUDI_INVALID_PARTITION_VALUE
Error message
Invalid partition value '%s' for %s partition key: %s
What it means
A partition value string read from the Hudi split could not be parsed into the partition column's declared Presto type. deserializePartitionValue converts string partition values (path segments / key-values) to the target type; any IllegalArgumentException from the parser is rethrown as HUDI_INVALID_PARTITION_VALUE with the value, type, and column name.
Source
Thrown at presto-hudi/src/main/java/com/facebook/presto/hudi/HudiPageSource.java:245
if (type instanceof VarcharType) {
return utf8Slice(valueString);
}
if (type.equals(VarbinaryType.VARBINARY)) {
return utf8Slice(valueString);
}
if (isShortDecimal(type) || isLongDecimal(type)) {
DecimalType decimalType = (DecimalType) type;
BigDecimal decimal = new BigDecimal(valueString);
decimal = decimal.setScale(decimalType.getScale(), BigDecimal.ROUND_UNNECESSARY);
if (decimal.precision() > decimalType.getPrecision()) {
throw new IllegalArgumentException();
}
BigInteger unscaledValue = decimal.unscaledValue();
return isShortDecimal(type) ? unscaledValue.longValue() : Decimals.encodeUnscaledValue(unscaledValue);
}
}
catch (IllegalArgumentException e) {
throw new PrestoException(HUDI_INVALID_PARTITION_VALUE, format(
"Invalid partition value '%s' for %s partition key: %s",
valueString,
type.getDisplayName(),
name));
}
// Hudi tables don't partition by non-primitive-type columns.
throw new PrestoException(NOT_SUPPORTED, "Invalid partition type " + type);
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Find the offending partition from the message and rewrite its value to match the column type (repair the partition path/data)
- Fix the writer so partition values are serialized in the canonical format for the column type (e.g. ISO dates)
- Alter the partition column type to one compatible with the stored string format and reload metadata
- Use Hudi's repair/overwrite tooling (e.g. repair partition or overwrite the partition with corrected key values)
Example fix
// before: partition dir written as 'dt=2026/09/01' for a date column
// after: write canonical value 'dt=2026-09-01'
writer.writePartitionValue("dt", LocalDate.of(2026, 9, 1).toString()); // "2026-09-01" Defensive patterns
Strategy: validation
Validate before calling
// Before scanning, validate partition values against the column type
String value = partitionKeyValue; // e.g. from directory name
Type type = partitionColumnType; // e.g. DATE
if (!canParse(value, type)) {
throw new IllegalStateException("Partition value '" + value +
"' is not a valid " + type.getDisplayName());
}
boolean canParse(String s, Type t) {
try {
if (t == BIGINT) Long.parseLong(s);
else if (t == DATE) LocalDate.parse(s);
else if (t == INTEGER) Integer.parseInt(s);
else return true;
return true;
} catch (RuntimeException e) { return false; }
} Try / catch
try {
return pageSource.getNextPage();
} catch (PrestoException e) {
if (isHudiErrorCode(e, "HUDI_INVALID_PARTITION_VALUE")) {
// repair/rewrite the offending partition, then retry
} else { throw e; }
} Prevention
- Standardize partition value serialization in writers (canonical ISO formats, zero-padded numbers)
- Add writer-side round-trip tests: parse every emitted partition value with the column type
- Validate partition directory names after external jobs write to the table
- Avoid renaming/reformatting partition columns after data exists
When it happens
Trigger: Scanning a Hudi partition whose stored string value cannot be converted by the target type's parser — e.g. non-numeric string for an integer partition column, malformed date/timestamp, out-of-range decimal, or empty value.
Common situations: Partition directories written with inconsistent formats (e.g. date partitioned as '2026-9-1' vs '2026-09-01'), partitions created by external tools with unparsable names, schema changed after data was written, URL-encoded or escaped values.
Related errors
- NOT_SUPPORTED
- NOT_SUPPORTED
- INVALID_FUNCTION_ARGUMENT
- QualifiedObjectName should have exactly 3 parts, found %s: %
- Invalid decimal value '{stringValue}'
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/8a52d9fa29a5c152.
Report an issue: GitHub.