apache/beam · error · UnsupportedOperationException
+fieldType.getTypeName()+ is not supported
Error message
+fieldType.getTypeName()+ is not supported
What it means
toPrettyFieldTypeString renders a FieldType as an indented pretty string but only implements the known TypeName branches (primitives, collections, maps, rows). Any other TypeName falls into the default branch and throws UnsupportedOperationException. This is a rendering limitation, not a data problem — the field type itself is valid, just not printable by this helper.
Source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/SchemaUtils.java:219
case LOGICAL_TYPE:
{
Schema.FieldType baseType =
Objects.requireNonNull(fieldType.getLogicalType()).getBaseType();
StringBuilder sb = new StringBuilder();
sb.append("<")
.append(toFieldTypeNameString(fieldType))
.append("(")
.append(fieldType.getLogicalType().getIdentifier())
.append(")> {\n");
sb.append(nextPrefix)
.append("<base>: ")
.append(toPrettyFieldTypeString(baseType, nextPrefix))
.append("\n");
sb.append(prefix).append("}");
return sb.toString();
}
default:
throw new UnsupportedOperationException(fieldType.getTypeName() + " is not supported");
}
}
static String toPrettyOptionsString(Schema.Options options, String prefix) {
String nextPrefix = prefix + INDENT;
StringBuilder sb = new StringBuilder();
sb.append("{\n");
for (String optionName : options.getOptionNames()) {
sb.append(nextPrefix)
.append(optionName)
.append(" = ")
.append(
toPrettyFieldValueString(
options.getType(optionName), options.getValue(optionName), nextPrefix))
.append("\n");
}
sb.append(prefix).append("}");
return sb.toString();View on GitHub (pinned to 12126d8942)
Solutions
- Upgrade Beam so toPrettyFieldTypeString covers the newer/logical TypeName.
- Replace the offending field type with a printable one before pretty-printing, or print with Schema.toString().
- Write a custom formatter that handles the unhandled TypeName via getLogicalType()/getTypeName().
- Catch UnsupportedOperationException and fall back to fieldType.toString() for the unsupported branches.
Example fix
// before
String pretty = SchemaUtils.toPrettySchemaString(schemaWithLogicalTypes); // throws UnsupportedOperationException
// after
try {
String pretty = SchemaUtils.toPrettySchemaString(schemaWithLogicalTypes);
} catch (UnsupportedOperationException e) {
String pretty = schemaWithLogicalTypes.toString(); // fallback rendering
} Defensive patterns
Strategy: try-catch
Validate before calling
boolean allPrintable = schema.getFields().stream()
.allMatch(f -> switch (f.getType().getTypeName()) {
case BYTE, INT16, INT32, INT64, FLOAT, DOUBLE, BOOLEAN, STRING, ARRAY,
ITERABLE, MAP, ROW -> true;
default -> false;
}); Type guard
boolean isPrettyPrintable(FieldType t) {
return t.getTypeName() != TypeName.LOGICAL_TYPE; // adjust per your Beam version's switch coverage
} Try / catch
try {
String pretty = SchemaUtils.toPrettySchemaString(schema);
} catch (UnsupportedOperationException e) {
LOG.warn("Pretty printer lacks support for a type; using toString(): {}", e.getMessage());
String pretty = schema.toString();
} Prevention
- Check the Beam version's switch coverage in SchemaUtils before using the pretty printer on exotic types.
- Prefer Schema.toString() or a custom formatter when schemas contain logical types.
- Keep Beam upgraded so newly added TypeNames are handled.
When it happens
Trigger: Calling SchemaUtils.toPrettySchemaString(schema) or toPrettyFieldTypeString(fieldType) on a schema containing a field whose TypeName is not handled by the switch — historically e.g. DATETIME / LOGICAL_TYPE / newer TypeName additions in Beam versions newer than this method's implementation.
Common situations: Pretty-printing a schema containing logical types (timestamps) or a TypeName added in a newer Beam release than the code calling this helper; dumping a SQL-derived schema with unhandled 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
- Unable to generate coder for schema {schema}
- Expecting exactly one field, found
- The input schema must have exactly one field of type byte.
- Cannot merge schemas with different numbers of fields. schem
- Cannot merge two types: +fieldType1.getTypeName()+ and +fiel
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/49790c163b9a82bf.
Report an issue: GitHub.