apache/beam · error · UnsupportedOperationException
Unable to get logical type ${identifier}
Error message
Unable to get logical type ${identifier} What it means
When generating the Java expression to read a Beam Row field for Calcite, getBeamField handles recognized logical type identifiers; an unrecognized identifier that is also not a PassThroughLogicalType triggers this UnsupportedOperationException. The codegen path cannot produce a getter for that logical type.
Source
Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java:631
"getLogicalTypeValue",
fieldName,
Expressions.constant(LocalDateTime.class)),
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);View on GitHub (pinned to 12126d8942)
Solutions
- Make the custom logical type implement PassThroughLogicalType with a supported base type
- Change the field to a supported primitive/logical type before the SQL stage
- Check the identifier against BeamCalcRel's supported list and upgrade Beam if support was added upstream
- Bypass SQL for that column (project it out before the query, re-add after)
Example fix
// before
new LogicalType<>("my.ns:custom", ...);
// after
new PassThroughLogicalType<>("my.ns:custom", FieldType.STRING, ..., ...); // or use FieldType.STRING Defensive patterns
Strategy: type-guard
Validate before calling
boolean codegenSupports(Schema.FieldType f) {
var lt = f.getLogicalType();
return lt == null || lt instanceof PassThroughLogicalType;
} Type guard
boolean isPassThrough(Schema.FieldType f) {
return f.getLogicalType() instanceof org.apache.beam.sdk.schemas.logicaltypes.PassThroughLogicalType;
} Try / catch
try {
rows.apply(SqlTransform.query(sql));
} catch (UnsupportedOperationException e) {
if (e.getMessage().startsWith("Unable to get logical type")) {
// convert field to supported type and re-plan
}
} Prevention
- Keep logical types in SQL-facing schemas limited to built-in/pass-through ones
- Add schema compatibility tests before SQL stages
- Project out unsupported columns upstream
- Track Beam release notes for logical-type support additions
When it happens
Trigger: A queried field's Schema.FieldType has a logical type whose identifier is not in the supported list (e.g. a custom LogicalType identifier) when BeamCalcRel compiles the Calc expression.
Common situations: Custom user logical types used in SQL-queried schemas; logical types introduced in newer Beam SDK versions but the SQL extension at runtime is older; mismatch between schema registration and SQL support.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Could not compile CalcFn: ${processElementBlock}
- Unable to convert logical type ${identifier}
- Unable to get ${typeName}
- Standard logical type '%s' does not have a static of('%s') m
- Error instantiating logical type '%s' with of('%s') method.
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/f7712fe57682fb82.
Report an issue: GitHub.