apache/flink · error · PbCodegenException
Do not support flink type:
Error message
Do not support flink type:
What it means
During protobuf codegen for deserialization, the factory dispatches on the Flink LogicalType: RowType, simple types, ArrayType, and MapType are handled; anything else falls through to this PbCodegenException. In practice this means the table schema contains a type the protobuf format cannot map, such as RAW, DISTINCT_TYPE, STRUCTURED_TYPE, or a unsupported root type on a non-proto field path.
Source
Thrown at flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/PbCodegenDeserializeFactory.java:48
/** Codegen factory class which return {@link PbCodegenDeserializer} of different data type. */
public class PbCodegenDeserializeFactory {
public static PbCodegenDeserializer getPbCodegenDes(
Descriptors.FieldDescriptor fd, LogicalType type, PbFormatContext formatContext)
throws PbCodegenException {
// We do not use FieldDescriptor to check because there's no way to get
// element field descriptor of array type.
if (type instanceof RowType) {
return new PbCodegenRowDeserializer(fd.getMessageType(), (RowType) type, formatContext);
} else if (PbFormatUtils.isSimpleType(type)) {
return new PbCodegenSimpleDeserializer(fd, type);
} else if (type instanceof ArrayType) {
return new PbCodegenArrayDeserializer(
fd, ((ArrayType) type).getElementType(), formatContext);
} else if (type instanceof MapType) {
return new PbCodegenMapDeserializer(fd, (MapType) type, formatContext);
} else {
throw new PbCodegenException("Do not support flink type: " + type);
}
}
public static PbCodegenDeserializer getPbCodegenTopRowDes(
Descriptors.Descriptor descriptor, RowType rowType, PbFormatContext formatContext) {
return new PbCodegenRowDeserializer(descriptor, rowType, formatContext);
}
}
View on GitHub (pinned to 2f3c205e92)
Solutions
- Read the exception message: it prints the exact offending LogicalType — locate that column in the DDL.
- Remove or cast the unsupported column (RAW/MULTISET/structured) to a supported type (INT, BIGINT, STRING/VARCHAR, BOOLEAN, FLOAT, DOUBLE, BYTES/VARBINARY, DECIMAL, DATE, TIME, TIMESTAMP, ROW, ARRAY, MAP).
- Re-run CREATE TABLE and verify schema validation passes before submitting the job.
Example fix
-- before
CREATE TABLE pb (
id BIGINT,
payload RAW
) WITH ('format'='protobuf', ...);
-- after
CREATE TABLE pb (
id BIGINT,
payload BYTES
) WITH ('format'='protobuf', ...); Defensive patterns
Strategy: type-guard
Validate before calling
static boolean pbSupports(LogicalType t) {
return t instanceof RowType
|| t instanceof ArrayType
|| t instanceof MapType
|| PbFormatUtils.isSimpleType(t);
}
rowType.getFields().forEach(f -> {
if (!pbSupports(f.getType())) throw new IllegalArgumentException("Unsupported: " + f.getName());
}); Type guard
boolean isPbMappable(LogicalType t) {
return t instanceof RowType || t instanceof ArrayType || t instanceof MapType
|| PbFormatUtils.isSimpleType(t);
} Prevention
- Keep protobuf table schemas to primitives, ROW, ARRAY, MAP only.
- Validate every nested field, not just top-level, before CREATE TABLE.
When it happens
Trigger: A table column typed RAW('...', ...) / MULTISET / structured type used with format='protobuf'; a column whose LogicalType root is not in PbFormatUtils.isSimpleType and not row/array/map.
Common situations: Protobuf tables derived from wide catalogs where a helper column (raw type, multiset) was left in the DDL; using types valid in SQL but not representable in proto3.
Related errors
- Illegal type for protobuf enum, only char/vachar/int/bigint
- Do not support flink data type:
- Unsupported data type in schema:
- Unsupported data type in schema:
- Unsupported Avro type '%s'.
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/45adefccd050110d.
Report an issue: GitHub.