split avro kafka field

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

split avro kafka field

Youzha
hi, i’am a new comer to learn flink stream. and i wanna try to split the kafka avro field into multiple fields.

for example i have this one in my kafka topic :

   id : 12345,
   name : “john”,
   location : “indonesia;jakarta;south jakarta”
}

and then i wanna split the location value by “;” into this one :


   id : 12345,
   name : “john”,
   country : “indonesia”,
   city : “jakarta”,
   locality : “south jakarta”
}

how can i do this with flink stream? 

need advice. 

Reply | Threaded
Open this post in threaded view
|

Re: split avro kafka field

Tzu-Li (Gordon) Tai
Hi,

1. You'd have to configure your Kafka connector source to use a
DeserializationSchema that deserializes the Kafka record byte to your
generated Avro type. You can use the shipped `AvroDeserializationSchema` for
that.

2. After your Kafka connector source, you can use a flatMap transformation
to do the splitting.

Cheers,
Gordon



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/