You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Alexandre Decuq (Jira)" <ji...@apache.org> on 2022/10/25 12:53:00 UTC

[jira] [Created] (FLINK-29758) Enum

Alexandre Decuq created FLINK-29758:
---------------------------------------

             Summary: 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


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)