Hi, “uid” is mainly useful when you upgrade your application. It’s used to match the operator state stored in the savepoint. As suggested in [1], “it is highly recommended to assign unique IDs to all operators of an application that might be upgraded in the future.”
[1]. https://ci.apache.org/projects/flink/flink-docs-stable/ops/upgrading.html#matching-operator-state From: "min....@ubs.com" <min....@ubs.com> Date: Thursday, 24 October 2019 at 11:31 PM To: "java.dev....@gmail.com" <java.dev....@gmail.com>, "dian0511...@gmail.com" <dian0511...@gmail.com> Cc: "user@flink.apache.org" <user@flink.apache.org> Subject: RE: Does operator uid() have to be unique across all jobs? Hi, I have some simple questions on the uid as well. 1. Do we add a uid for every operator e.g. print(), addSink and addSource? 2. For chained operators, do we need to uids for each operator? Or just the last operator? e.g. .map(....).uid("some-id").print().uid("print-id"); Regards, Min From: John Smith [mailto:java.dev....@gmail.com] Sent: Donnerstag, 24. Oktober 2019 16:32 To: Dian Fu Cc: user Subject: [External] Re: Does operator uid() have to be unique across all jobs? Ok cool. Thanks BTW this seems a bit cumbersome... .map(....).uid("some-id").name("some-id"); On Wed, 23 Oct 2019 at 21:13, Dian Fu <dian0511...@gmail.com<mailto:dian0511...@gmail.com>> wrote: Yes, you can use it in another job. The uid needs only to be unique within a job. > 在 2019年10月24日,上午5:42,John Smith > <java.dev....@gmail.com<mailto:java.dev....@gmail.com>> 写道: > > When setting uid() of an operator does it have to be unique across all jobs > or just unique within a job? > > For example can I use env.addSource(myKafkaConsumer).uid("kafka-consumer") in > another job?