{"record":{"id":"a3b70c6c94276c61","repo":"apache/iceberg","slug":"unsupported-type-for-frompartitionstring-type","errorCode":null,"errorMessage":"Unsupported type for fromPartitionString: + type","messagePattern":"Unsupported type for fromPartitionString: \\+ type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/types/Conversions.java","lineNumber":76,"sourceCode":"      case FLOAT:\n        return Float.valueOf(asString);\n      case DOUBLE:\n        return Double.valueOf(asString);\n      case STRING:\n        return asString;\n      case UUID:\n        return UUID.fromString(asString);\n      case FIXED:\n        Types.FixedType fixed = (Types.FixedType) type;\n        return Arrays.copyOf(asString.getBytes(StandardCharsets.UTF_8), fixed.length());\n      case BINARY:\n        return asString.getBytes(StandardCharsets.UTF_8);\n      case DECIMAL:\n        return new BigDecimal(asString);\n      case DATE:\n        return Literal.of(asString).to(Types.DateType.get()).value();\n      default:\n        throw new UnsupportedOperationException(\n            \"Unsupported type for fromPartitionString: \" + type);\n    }\n  }\n\n  private static final ThreadLocal<CharsetEncoder> ENCODER =\n      ThreadLocal.withInitial(StandardCharsets.UTF_8::newEncoder);\n  private static final ThreadLocal<CharsetDecoder> DECODER =\n      ThreadLocal.withInitial(StandardCharsets.UTF_8::newDecoder);\n\n  public static ByteBuffer toByteBuffer(Type type, Object value) {\n    return toByteBuffer(type.typeId(), value);\n  }\n\n  public static ByteBuffer toByteBuffer(Type.TypeID typeId, Object value) {\n    if (value == null) {\n      return null;\n    }\n","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/types/Conversions.java#L58-L94","documentation":"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.","triggerScenarios":"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.","commonSituations":"Manual partition-value parsing of tables partitioned by timestamp transforms; tools reconstructing data file paths for newer spec types.","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"],"exampleFix":"// before\nObject v = Conversions.fromPartitionString(Types.TimestampType.withZone(), \"2023-01-01T00:00:00\");\n// after\nlong micros = Literal.of(\"2023-01-01T00:00:00\").to(Types.TimestampType.withoutZone()).value(); // convert to epoch micros yourself","handlingStrategy":"type-guard","validationCode":"Set<Type.TypeID> ok = Set.of(BOOLEAN, INTEGER, LONG, FLOAT, DOUBLE, STRING, UUID, FIXED, BINARY, DECIMAL, DATE);\nif (!ok.contains(type.typeId())) throw new IllegalArgumentException(\"fromPartitionString unsupported for: \" + type);","typeGuard":"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()); }","tryCatchPattern":"try { v = Conversions.fromPartitionString(type, s); } catch (UnsupportedOperationException e) { v = convertManually(type, s); }","preventionTips":["Handle timestamp partition values manually via Literal.of(...).to(...)","Check typeId before calling","Centralize partition-string parsing in one utility"],"tags":["java","conversions","partitioning","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}