prestodb/presto · error · PrestoException
GENERIC_USER_ERROR
GENERIC_USER_ERROR
Error message
invalid joda pattern '%s' passed as format hint for column '%s'
What it means
CustomDateTimeJsonFieldDecoder's constructor requires a format hint and compiles it with Joda-Time's DateTimeFormat.forPattern. If the pattern string is not a valid Joda pattern, the IllegalArgumentException is converted to a PrestoException GENERIC_USER_ERROR with this message. It is a table-definition error caught at decoder construction time, before any data is read.
Source
Thrown at presto-record-decoder/src/main/java/com/facebook/presto/decoder/json/CustomDateTimeJsonFieldDecoder.java:67
{
private static final Set<Type> SUPPORTED_TYPES = ImmutableSet.of(DATE, TIME, TIME_WITH_TIME_ZONE, TIMESTAMP, TIMESTAMP_WITH_TIME_ZONE);
private final DecoderColumnHandle columnHandle;
private final DateTimeFormatter formatter;
public CustomDateTimeJsonFieldDecoder(DecoderColumnHandle columnHandle)
{
this.columnHandle = requireNonNull(columnHandle, "columnHandle is null");
if (!SUPPORTED_TYPES.contains(columnHandle.getType())) {
throwUnsupportedColumnType(columnHandle);
}
checkArgument(columnHandle.getFormatHint() != null, "format hint not defined for column '%s'", columnHandle.getName());
try {
formatter = DateTimeFormat.forPattern(columnHandle.getFormatHint()).withLocale(Locale.ENGLISH).withZoneUTC();
}
catch (IllegalArgumentException e) {
throw new PrestoException(
GENERIC_USER_ERROR,
format("invalid joda pattern '%s' passed as format hint for column '%s'", columnHandle.getFormatHint(), columnHandle.getName()));
}
}
@Override
public FieldValueProvider decode(JsonNode value)
{
return new CustomDateTimeJsonValueProvider(value, columnHandle, formatter);
}
public static class CustomDateTimeJsonValueProvider
extends AbstractDateTimeJsonValueProvider
{
private final DateTimeFormatter formatter;
public CustomDateTimeJsonValueProvider(JsonNode value, DecoderColumnHandle columnHandle, DateTimeFormatter formatter)
{View on GitHub (pinned to 55bb57d202)
Solutions
- Correct the format hint to valid Joda-Time pattern syntax (yyyy, MM, dd, HH, mm, ss; quote literals with single quotes)
- Test the pattern in isolation with DateTimeFormat.forPattern(...) before updating the table definition
- Replace non-Joda tokens (e.g. 'HH24:MI:SS' -> 'HH:mm:ss', 'DD' -> 'dd')
- Wrap literal text in the pattern in single quotes, e.g. "yyyy-MM-dd'T'HH:mm:ss"
Example fix
// before format hint: 'YYYY-MM-DD HH24:MI:SS' // after format hint: 'yyyy-MM-dd HH:mm:ss'
Defensive patterns
Strategy: validation
Validate before calling
boolean isValidJodaPattern(String pattern) {
try {
org.joda.time.format.DateTimeFormat.forPattern(pattern);
return true;
} catch (IllegalArgumentException e) {
return false;
}
} Try / catch
try {
CsvColumnDecoder d = new CsvColumnDecoder(columnHandles); // or json decoder construction
} catch (PrestoException e) {
if (e.getErrorCode().getName().equals("GENERIC_USER_ERROR") && e.getMessage().contains("invalid joda pattern")) {
throw new TableConfigException("Fix format hint in table definition", e);
}
throw e;
} Prevention
- Validate format hints with DateTimeFormat.forPattern in CI before applying table DDL
- Quote literal characters in patterns ('T', timezones) with single quotes
- Use Joda docs tokens: yyyy MM dd HH mm ss — not SQL style HH24/MI/SS
- Keep a tested library of approved patterns for common source formats
When it happens
Trigger: format hint contains invalid Joda pattern letters (e.g. 'YYYY-MM-DD hh:mm:ss' misusing D vs d, or stray characters like unquoted 'T' or punctuation Joda treats as pattern letters); hint copied from a SimpleDateFormat or moment.js pattern incompatible with Joda syntax.
Common situations: Authors writing SQL-style 'YYYY-MM-DD HH24:MI:SS' formats; using 'DD' (day-of-year) instead of 'dd' (day-of-month); forgetting to quote literal text like 'T' or 'UTC' inside the pattern; porting patterns from other libraries (java.time mostly compatible, moment/chrony not).
Related errors
- Invalid JSON file '%s' for '%s'
- DECODER_CONVERSION_NOT_SUPPORTED
- DECODER_CONVERSION_NOT_SUPPORTED
- Unknown property at line %s:%s: %s
- ACCUMULO_TABLE_EXISTS
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/e57b572380617a48.
Report an issue: GitHub.