apache/iceberg · error
Unsupported type for fromPartitionString: + type
Error message
Unsupported type for fromPartitionString: + type
What it means
Conversions.fromPartitionString converts a human-readable partition string (e.g. from a path or predicate) into the internal Java value for a primitive type. Only a fixed set of types (boolean, int, long, float, double, string, uuid, fixed/binary, decimal, date) is supported; any other primitive type (notably timestamp/timestamptz and unknown types) throws UnsupportedOperationException.
Source
Thrown at api/src/main/java/org/apache/iceberg/types/Conversions.java:76
case FLOAT:
return Float.valueOf(asString);
case DOUBLE:
return Double.valueOf(asString);
case STRING:
return asString;
case UUID:
return UUID.fromString(asString);
case FIXED:
Types.FixedType fixed = (Types.FixedType) type;
return Arrays.copyOf(asString.getBytes(StandardCharsets.UTF_8), fixed.length());
case BINARY:
return asString.getBytes(StandardCharsets.UTF_8);
case DECIMAL:
return new BigDecimal(asString);
case DATE:
return Literal.of(asString).to(Types.DateType.get()).value();
default:
throw new UnsupportedOperationException(
"Unsupported type for fromPartitionString: " + type);
}
}
private static final ThreadLocal<CharsetEncoder> ENCODER =
ThreadLocal.withInitial(StandardCharsets.UTF_8::newEncoder);
private static final ThreadLocal<CharsetDecoder> DECODER =
ThreadLocal.withInitial(StandardCharsets.UTF_8::newDecoder);
public static ByteBuffer toByteBuffer(Type type, Object value) {
return toByteBuffer(type.typeId(), value);
}
public static ByteBuffer toByteBuffer(Type.TypeID typeId, Object value) {
if (value == null) {
return null;
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Convert the string to a java.time.LocalDateTime/Instant yourself and use Literal.of(...).to(type) to get the typed value
- Only call fromPartitionString for supported types; check type.typeId() first
- For timestamp partitions convert the string to epoch micros manually before writing
Example fix
// before
Object v = Conversions.fromPartitionString(Types.TimestampType.withZone(), "2023-01-01T00:00:00");
// after
long micros = Literal.of("2023-01-01T00:00:00").to(Types.TimestampType.withoutZone()).value(); // convert to epoch micros yourself Defensive patterns
Strategy: type-guard
Validate before calling
Set<Type.TypeID> ok = Set.of(BOOLEAN, INTEGER, LONG, FLOAT, DOUBLE, STRING, UUID, FIXED, BINARY, DECIMAL, DATE);
if (!ok.contains(type.typeId())) throw new IllegalArgumentException("fromPartitionString unsupported for: " + type); Type guard
boolean supportsFromString(Type t) { return EnumSet.of(TypeID.BOOLEAN, TypeID.INTEGER, TypeID.LONG, TypeID.FLOAT, TypeID.DOUBLE, TypeID.STRING, TypeID.UUID, TypeID.FIXED, TypeID.BINARY, TypeID.DECIMAL, TypeID.DATE).contains(t.typeId()); } Try / catch
try { v = Conversions.fromPartitionString(type, s); } catch (UnsupportedOperationException e) { v = convertManually(type, s); } Prevention
- Handle timestamp partition values manually via Literal.of(...).to(...)
- Check typeId before calling
- Centralize partition-string parsing in one utility
When it happens
Trigger: Partition string parsing for a partition field whose type is TIMESTAMP, TIMESTAMPTZ, TIME, UNKNOWN, or a geo type; passing a non-primitive type to fromPartitionString.
Common situations: Manual partition-value parsing of tables partitioned by timestamp transforms; tools reconstructing data file paths for newer spec types.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Identity transform is not supported
- Bucket transform is not supported
- Truncate transform is not supported
- Cannot bind unsupported transform: %s
- Cannot serialize type: + typeId
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/a3b70c6c94276c61.
Report an issue: GitHub.