apache/beam · error · RuntimeException
RenameFields does not support renaming logical types.
Error message
RenameFields does not support renaming logical types.
What it means
renameFieldType recursively applies renames to a FieldType's structure, but logical types are not supported: renaming nested fields inside a logical type's representation is not implemented, so the LOGICAL_TYPE case throws RuntimeException rather than silently producing a wrong schema.
Source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/RenameFields.java:127
inputType.getCollectionElementType(),
renames,
renamedSchemasMap,
nestedFieldRenamedMap));
case ITERABLE:
return FieldType.iterable(
renameFieldType(
inputType.getCollectionElementType(),
renames,
renamedSchemasMap,
nestedFieldRenamedMap));
case MAP:
return FieldType.map(
renameFieldType(
inputType.getMapKeyType(), renames, renamedSchemasMap, nestedFieldRenamedMap),
renameFieldType(
inputType.getMapValueType(), renames, renamedSchemasMap, nestedFieldRenamedMap));
case LOGICAL_TYPE:
throw new RuntimeException("RenameFields does not support renaming logical types.");
default:
return inputType;
}
}
// Apply the user-specified renames to the input schema.
@VisibleForTesting
static void renameSchema(
Schema inputSchema,
Collection<RenamePair> renames,
Map<UUID, Schema> renamedSchemasMap,
Map<UUID, BitSet> nestedFieldRenamedMap) {
// The mapping of renames to apply at this level of the schema.
Map<Integer, String> topLevelRenames = Maps.newHashMap();
// For nested schemas, collect all applicable renames here.
Multimap<Integer, RenamePair> nestedRenames = ArrayListMultimap.create();
for (RenamePair rename : renames) {View on GitHub (pinned to 12126d8942)
Solutions
- Convert the logical type column to a plain ROW/primitive before renaming, then convert back after.
- Drop or replace logical-typed fields before applying RenameFields.
- Implement renaming via a custom DoFn mapping Row fields instead of RenameFields.
- Check FieldType.getTypeName() for LOGICAL_TYPE in a pre-check and handle it manually.
Example fix
// before schema containing FieldType of logicalType "myLogical" p.apply(RenameFields.of(...)) // after select fields without the logical type, rename, then re-add the logical type field
Defensive patterns
Strategy: validation
Validate before calling
boolean hasLogical(Schema s) { return s.getFields().stream().anyMatch(f -> containsLogical(f.getType())); } if (hasLogical(inputSchema)) { /* rename manually or convert logical types first */ } Type guard
boolean containsLogical(FieldType t) { if (t.getTypeName()==TypeName.LOGICAL_TYPE) return true; return t.getCollectionElementType()!=null ? containsLogical(t.getCollectionElementType()) : (t.getRowSchema()!=null && containsLogical(t.getRowSchema())); } Try / catch
try { out = input.apply(RenameFields.of(renames)); } catch (RuntimeException e) { if (e.getMessage().contains("logical types")) { /* use manual Row field mapping */ } throw e; } Prevention
- Scan schemas for LOGICAL_TYPE fields before applying RenameFields
- Prefer Select/DoFn-based field mapping when logical types are present
- Keep logical-type columns out of rename pipelines
When it happens
Trigger: Applying RenameFields to a schema (or nested schema/map/array element) containing a LOGICAL_TYPE field — e.g. a custom logical type column — even when the rename targets only other fields.
Common situations: Pipelines with schemas containing logical types (e.g. custom LogicalType implementations or certain portable/SQL logical types) being passed through RenameFields for column-name harmonization.
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
- Standard logical type '%s' does not have a static of('%s') m
- Error instantiating logical type '%s' with of('%s') method.
- ${resolved} references multiple fields.
- Unable to convert logical type ${identifier}
- Unable to get logical type ${identifier}
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/ed723922a81007c7.
Report an issue: GitHub.