flinksql读取format为avro的kafka topic 报错 ArrayIndexOutOfBoundsException

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

flinksql读取format为avro的kafka topic 报错 ArrayIndexOutOfBoundsException

祁洁
我的flinksql为:CREATE TABLE kafkaInputTable ( 
   name String,
   address String
) WITH ( 
   'connector' = 'kafka', 
   'topic' = 'test',
   'properties.bootstrap.servers' = 'node1:9092,node2:9092,node3:9092',
   'format' = 'avro'
   );
CREATE TABLE kafkaOutputTable ( 
   name String,
   address String 
) WITH ( 
   'connector' = 'kafka', 
   'topic' = 'test1',
   'properties.bootstrap.servers' = 'node1:9092,node2:9092,node3:9092',
   'format' = 'csv'
   );
INSERT INTO kafkaOutputTable SELECT name, address FROM kafkaInputTable;



当我往报错test 这个topic生产avro格式的数据时,报错:Failed ro deserialize Avro record......ArrayIndexOutOfBoundsException: 6
{
  "namespace": "cc.unmi.data",
  "type": "record",
  "name": "User",
  "fields": [
    {"name": "name", "type": "string"},
    {"name": "address", "type": ["string", "null"]}
  ]
}



请教一下我这么写哪里有问题,如果avro格式的表作为sink就没这个问题。
Reply | Threaded
Open this post in threaded view
|

Re: flinksql读取format为avro的kafka topic 报错 ArrayIndexOutOfBoundsException

wxpcc
声明可以尝试加上 not null,避免变为 union类型
如:
headers map<string not null,String not null> not null,
`body` String not null



--
Sent from: http://apache-flink.147419.n8.nabble.com/