{"record":{"id":"764b2cdf09528c2c","repo":"apache/flink","slug":"do-not-support-flink-data-type","errorCode":null,"errorMessage":"Do not support flink data type: ","messagePattern":"Do not support flink data type: ","errorType":"exception","errorClass":"PbCodegenException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/serialize/PbCodegenSerializeFactory.java","lineNumber":46,"sourceCode":"\nimport com.google.protobuf.Descriptors;\n\n/** Codegen factory class which return {@link PbCodegenSerializer} of different data type. */\npublic class PbCodegenSerializeFactory {\n    public static PbCodegenSerializer getPbCodegenSer(\n            Descriptors.FieldDescriptor fd, LogicalType type, PbFormatContext formatContext)\n            throws PbCodegenException {\n        if (type instanceof RowType) {\n            return new PbCodegenRowSerializer(fd.getMessageType(), (RowType) type, formatContext);\n        } else if (PbFormatUtils.isSimpleType(type)) {\n            return new PbCodegenSimpleSerializer(fd, type, formatContext);\n        } else if (type instanceof ArrayType) {\n            return new PbCodegenArraySerializer(\n                    fd, ((ArrayType) type).getElementType(), formatContext);\n        } else if (type instanceof MapType) {\n            return new PbCodegenMapSerializer(fd, (MapType) type, formatContext);\n        } else {\n            throw new PbCodegenException(\"Do not support flink data type: \" + type);\n        }\n    }\n\n    public static PbCodegenSerializer getPbCodegenTopRowSer(\n            Descriptors.Descriptor descriptor, RowType rowType, PbFormatContext formatContext) {\n        return new PbCodegenRowSerializer(descriptor, rowType, formatContext);\n    }\n}\n","sourceCodeStart":28,"sourceCodeEnd":55,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/serialize/PbCodegenSerializeFactory.java#L28-L55","documentation":"Serialization-side twin of the deserializer factory: it dispatches on LogicalType into Row/simple/Array/Map serializers; anything else (RAW, MULTISET, structured/distinct types) throws PbCodegenException at codegen time with the offending type in the message.","triggerScenarios":"INSERT INTO a protobuf sink whose table schema contains an unsupported LogicalType; computed columns producing RAW or MULTISET types that reach the serializer.","commonSituations":"Reusing a source schema for a protobuf sink after adding metadata/RAW columns; SQL views with multiset aggregations written to protobuf.","solutions":["Locate the column printed in the message and drop or cast it to a protobuf-mappable type.","Restrict sink column lists: INSERT INTO pb_sink (id, name) SELECT ... so unsupported intermediate columns never reach the format.","Validate the final query plan's output schema before submission."],"exampleFix":"-- before\nINSERT INTO pb_sink SELECT id, collect(name) FROM src GROUP BY id;\n-- after\nINSERT INTO pb_sink (id) SELECT id FROM src GROUP BY id;","handlingStrategy":"type-guard","validationCode":"static boolean pbSupports(LogicalType t) {\n    return t instanceof RowType || t instanceof ArrayType || t instanceof MapType\n            || PbFormatUtils.isSimpleType(t);\n}\n// validate the query's resolved output before INSERT:\nfor (int i = 0; i < sinkRowType.getFieldCount(); i++) {\n    if (!pbSupports(sinkRowType.getTypeAt(i))) throw new IllegalArgumentException(\"Column \" + i);\n}","typeGuard":"boolean isPbMappable(LogicalType t) {\n    return t instanceof RowType || t instanceof ArrayType || t instanceof MapType\n            || PbFormatUtils.isSimpleType(t);\n}","tryCatchPattern":null,"preventionTips":["Project explicit column lists in INSERT statements instead of SELECT *.","Avoid MULTISET/RAW/structured types anywhere in protobuf sink schemas."],"tags":["protobuf","codegen","serialization","type-mapping"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}