apache/beam · error · java.lang.UnsupportedOperationException
Unable to get ${typeName}
Error message
Unable to get ${typeName} What it means
Default branch of the codegen getter: when a field's TypeName has no expression mapping in getBeamField, UnsupportedOperationException 'Unable to get <typeName>' is thrown while compiling the Calc operator. It means Beam SQL cannot generate accessor code for that schema type.
Source
Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java:634
LocalDateTime.class);
} else if (org.apache.beam.sdk.schemas.logicaltypes.Timestamp.IDENTIFIER.equals(
identifier)) {
return Expressions.convert_(
Expressions.call(
expression,
"getLogicalTypeValue",
fieldName,
Expressions.constant(java.time.Instant.class)),
java.time.Instant.class);
} else if (FixedPrecisionNumeric.IDENTIFIER.equals(identifier)) {
return Expressions.call(expression, "getDecimal", fieldName);
} else if (logicalType instanceof PassThroughLogicalType) {
return getBeamField(list, expression, fieldName, logicalType.getBaseType());
} else {
throw new UnsupportedOperationException("Unable to get logical type " + identifier);
}
default:
throw new UnsupportedOperationException("Unable to get " + fieldType.getTypeName());
}
}
// Value conversion: Beam => Calcite
private static Expression toCalciteValue(
Expression value, FieldType fieldType, boolean useByteString) {
switch (fieldType.getTypeName()) {
case BYTE:
return Expressions.convert_(value, Byte.class);
case INT16:
return Expressions.convert_(value, Short.class);
case INT32:
return Expressions.convert_(value, Integer.class);
case INT64:
return Expressions.convert_(value, Long.class);
case DECIMAL:
return Expressions.convert_(value, BigDecimal.class);
case FLOAT:View on GitHub (pinned to 12126d8942)
Solutions
- Flatten or remove the unsupported field from the schema before the SQL transform
- Project only supported columns before running the query
- Convert the field to a supported representation (e.g. JSON string) upstream
- Upgrade Apache Beam for broader type coverage in the SQL extension
Example fix
// before
Schema schema = Schema.builder().addField("complex", unsupportedFieldType).build();
// after
Schema schema = Schema.builder().addStringField("complexAsJson").build(); // serialize before SQL Defensive patterns
Strategy: type-guard
Validate before calling
boolean typeNameSupported(Schema.FieldType f) {
switch (f.getTypeName()) {
case BYTE: case INT16: case INT32: case INT64: case FLOAT: case DOUBLE:
case BOOLEAN: case STRING: case DATETIME: return true;
default: return f.isCollectionType() || f.isMapType();
}
} Type guard
boolean isSimpleField(Schema.FieldType f) {
return !f.getTypeName().isNestedType() && f.getLogicalType() == null;
} Try / catch
try {
rows.apply(SqlTransform.query(sql));
} catch (UnsupportedOperationException e) {
if (e.getMessage().startsWith("Unable to get ")) {
// serialize/flatten the field and retry the query
}
} Prevention
- Restrict SQL input schemas to flat, primitive-typed fields
- Serialize nested/exotic types to JSON strings before SQL
- Test the full query against real inferred schemas in CI
- Upgrade Beam to get broader TypeName coverage
When it happens
Trigger: The input schema contains a field type with a TypeName the SQL bridge has no case for (e.g. certain ROW/nested or exotic types) when the query planner builds code to read that column.
Common situations: Querying PCollections with complex nested schemas; types surfaced from Avro/Proto inference; older Beam versions where newer schema TypeNames lack SQL support.
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
- Could not compile CalcFn: ${processElementBlock}
- Unable to convert logical type ${identifier}
- Unable to convert ${typeName}
- Unable to find value #${index}
- Unable to get logical type ${identifier}
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/dc4fd951c132a77a.
Report an issue: GitHub.