You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Martijn Visser (Jira)" <ji...@apache.org> on 2022/10/25 14:01:00 UTC
[jira] [Commented] (FLINK-29758) Serialization issue with enum
[ https://issues.apache.org/jira/browse/FLINK-29758?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17623849#comment-17623849 ]
Martijn Visser commented on FLINK-29758:
----------------------------------------
Per https://nightlies.apache.org/flink/flink-docs-master/docs/connectors/table/formats/avro/ enum isn't supported as a type in Flink. See also FLINK-29267
> Serialization issue with enum
> -----------------------------
>
> Key: FLINK-29758
> URL: https://issues.apache.org/jira/browse/FLINK-29758
> Project: Flink
> Issue Type: Bug
> Components: API / Type Serialization System
> Affects Versions: 1.14.5
> Reporter: Alexandre Decuq
> Priority: Major
>
> Hello,
> I am implementing an SQL script between two Kafka topics (Avro).
> One field of my input is a STRING, the equivalent in output has been defined as ENUM.
> Here snaps of code:
> Avro input
> {code:java}
> {
> "name": "CompanyBankAccountMessage",
> "type": "record",
> "namespace": "com.kyriba.dataproduct.core.model.input",
> "fields": [
> {
> "default": null,
> "name": "ACCOUNT_TYPE",
> "type": [
> "null",
> "int"
> ]
> },
> ...
> },{code}
> Avro output
> {code:java}
> {
> "name": "Account",
> "type": "record",
> "namespace": "com.kyriba.dataproduct.core.model.output",
> "fields": [
> {
> "name": "type",
> "type": {
> "type": "enum",
> "name": "Type",
> "symbols": [
> "All",
> "Bank_account",
> "Intercompany_account",
> "Shared_account",
> "Other_account"
> ]
> }
> },
> ...
> ]
> }{code}
> My SQL looks like
> {code:java}
> INSERT INTO `my.output.account.v1.avro`
> SELECT BANK_ACCOUNT_TYPE type,
> ...
> FROM `my.input.COMPANY_BANK_ACCOUNT.v1.avro`{code}
> I got this exception:
> {code:java}
> Caused by: java.lang.RuntimeException: Failed to serialize row.
> at org.apache.flink.formats.avro.AvroRowDataSerializationSchema.serialize(AvroRowDataSerializationSchema.java:90)
> at com.kyriba.flink.datacatalog.formats.datacatalog.DataCatalogAvroRowDataSerializationSchema.serialize(DataCatalogAvroRowDataSerializationSchema.java:37)
> ...
> Caused by: org.apache.avro.AvroTypeException: value Bank_account (a org.apache.avro.util.Utf8) is not a Type at Account.type
> ...
> Caused by: org.apache.avro.AvroTypeException: value Bank_account (a org.apache.avro.util.Utf8) is not a Type {code}
> Did I make something wrong or this is a bug?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)