Hi Wayne,
The only obvious difference between you ACRO schema and the table schema is,
that you AVRO ccc is nullable and your SQL ‘ccc’ is not nullable.
Please adjust one of the two.
Also (not entirely sure) in order to correctly map an AVRO nullable to SQL it
needs to have a default value like this:
},{
"name" : "ccc",
"type" : [ "null", "string" ]
"default" : null
},
Try if that makes any difference 😊
Thias
From: Wayne <[email protected]>
Sent: Freitag, 27. August 2021 02:29
To: [email protected]
Subject: Flink sql CLI parsing avro format data error 解析avro数据失败
i have Apache Avro schema
我的avro schema 如下
{
"type" : "record",
"name" : "KafkaAvroMessage",
"namespace" : "xxx",
"fields" : [ {
"name" : "aaa",
"type" : "string"
}, {
"name" : "bbb",
"type" : [ "null", "string" ],
"default" : null
},{
"name" : "ccc",
"type" : [ "null", "string" ]
},
{
"name" : "ddd",
"type" : "string",
"default" : ""
} ]
}
The sql worte is like this
我下的sql如下
CREATE TABLE xxx (
`aaa` STRING NOT NULL,
`bbb` STRING ,
`ccc` STRING NOT NULL,
`ddd` STRING NOT NULL
) WITH(
...
'format' = 'avro'
);
The sql can parse the aaa bbb ddd field correctly,but cannot parse the ccc
field. Excuse me,what is the problem with my sql writing,please give me a
correct wording
这个sql可以解析 aaa、bbb、ddd 字段,不能解析ccc字段,请问我如果想用flinksql 解析这个schema,正确的写法是什么
Diese Nachricht ist ausschliesslich für den Adressaten bestimmt und beinhaltet
unter Umständen vertrauliche Mitteilungen. Da die Vertraulichkeit von
e-Mail-Nachrichten nicht gewährleistet werden kann, übernehmen wir keine
Haftung für die Gewährung der Vertraulichkeit und Unversehrtheit dieser
Mitteilung. Bei irrtümlicher Zustellung bitten wir Sie um Benachrichtigung per
e-Mail und um Löschung dieser Nachricht sowie eventueller Anhänge. Jegliche
unberechtigte Verwendung oder Verbreitung dieser Informationen ist streng
verboten.
This message is intended only for the named recipient and may contain
confidential or privileged information. As the confidentiality of email
communication cannot be guaranteed, we do not accept any responsibility for the
confidentiality and the intactness of this message. If you have received it in
error, please advise the sender by return e-mail and delete this message and
any attachments. Any unauthorised use or dissemination of this information is
strictly prohibited.