apache/beam · error · UnsupportedOperationException
Unable to convert ${typeName}
Error message
Unable to convert ${typeName} What it means
Fallback branch of toBeamObject: when a Schema Field's TypeName has no mapping to a Calcite value type (e.g. certain row/nested or exotic types unsupported by the SQL bridge), this UnsupportedOperationException is thrown with the type name. It signals that Beam SQL cannot represent that field type in its row conversion.
Source
Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java:472
}
return LocalDateTime.of(
LocalDate.ofEpochDay(((Number) value).longValue() / MILLIS_PER_DAY),
LocalTime.ofNanoOfDay(
(((Number) value).longValue() % MILLIS_PER_DAY) * NANOS_PER_MILLISECOND));
} else if (org.apache.beam.sdk.schemas.logicaltypes.Timestamp.IDENTIFIER.equals(
identifier)) {
if (value instanceof Timestamp) {
value = SqlFunctions.toLong((Timestamp) value);
}
return java.time.Instant.ofEpochMilli(((Number) value).longValue());
} else {
if (logicalType instanceof PassThroughLogicalType) {
return toBeamObject(value, logicalType.getBaseType(), verifyValues);
}
throw new UnsupportedOperationException("Unable to convert logical type " + identifier);
}
default:
throw new UnsupportedOperationException("Unable to convert " + fieldType.getTypeName());
}
}
private static List<Object> toBeamList(
List<Object> arrayValue, FieldType elementType, boolean verifyValues) {
return arrayValue.stream()
.map(e -> toBeamObject(e, elementType, verifyValues))
.collect(Collectors.toList());
}
private static Map<Object, Object> toBeamMap(
Map<Object, Object> mapValue,
FieldType keyType,
FieldType elementType,
boolean verifyValues) {
Map<Object, Object> output = new HashMap<>(mapValue.size());
for (Map.Entry<Object, Object> entry : mapValue.entrySet()) {
output.put(View on GitHub (pinned to 12126d8942)
Solutions
- Flatten or restructure the schema so only SQL-supported types (primitives, arrays, maps, simple logical types) remain before the query
- Select only supported columns in the SQL statement
- Convert unsupported fields to supported types (e.g. serialize nested structs to JSON strings) beforehand
- Upgrade Beam — type coverage in the SQL extension grows across releases
Example fix
// before
PCollection<Row> out = p.apply(SqlTransform.query("SELECT nested_col FROM t"));
// after
Row flattened = row.getValue("nested_col"); // extract/flatten before SQL, or select supported fields Defensive patterns
Strategy: type-guard
Validate before calling
boolean allFieldsSupported(Schema s) {
return s.getFields().stream().allMatch(f ->
java.util.Set.of(BOOLEAN,BYTE,INT16,INT32,INT64,FLOAT,DOUBLE,STRING,DATETIME)
.contains(f.getType().getTypeName()) || f.getType().isCollectionType() || f.getType().isMapType());
} Type guard
boolean isFlatPrimitive(Schema.FieldType t) {
return !t.isNestedType() && t.getLogicalType() == null;
} Try / catch
try {
rows.apply(SqlTransform.query(sql));
} catch (UnsupportedOperationException e) {
// project out/flatten the offending field and retry
} Prevention
- Flatten nested structs before SQL stages
- Avoid inferring schemas directly from Avro/Proto for SQL inputs without review
- Test queries against representative schemas in CI
- Upgrade Beam when new schema types are introduced
When it happens
Trigger: Querying a table whose schema contains a field type unsupported by the SQL extension (e.g. certain nested STRUCT/ROW layouts or map variants in some Beam versions) so the switch in toBeamObject reaches default.
Common situations: Beam SQL over a PCollection with complex nested schemas; schemas inferred from Avro/protobuf with types the SQL extension hasn't mapped; older Beam versions lacking support for newer schema 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 convert logical type ${identifier}
- Unable to find value #${index}
- Unable to get ${typeName}
- Unreachable case for Beam typename %s
- '${fieldName}' field is invalid at the top level for Kafka i
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/14219d3b79618383.
Report an issue: GitHub.