I have a pipeline where I'm trying to add a new operator. The problem is
that originally I forgot to specify the uid for one source. To remedy this,
I'm using setUidHash, providing the operator id to match that in my
savepoints / current job graph.

Unless I'm doing something wrong, what I've observed is that the value
provided to setUidHash is completely ignored by Flink. I've tried to
summarize it in the following test:

```java
  @Test
  public void testSetUidHash() throws Exception {
    var uidHash = "cbc357ccb763df2852fee8c4fc7d55f2";
    env.fromElements(1, 2, 3)
        .name("123")
        .setUidHash(uidHash)
        //.uid("123")
        .print()
        .name("print")
        .uid("print");

    var vertex = StreamSupport

.stream(env.getStreamGraph().getJobGraph().getVertices().spliterator(),
false)
        .filter(v -> v.getName().equals("Source: 123"))
        .findFirst()
        .orElseThrow();

    assertEquals(uidHash, vertex.getID());
    // Fails with java.lang.AssertionError (if setUidHash is used):
    // expected:<cbc357ccb763df2852fee8c4fc7d55f2> but
was:<bc764cd8ddf7a0cff126f51c16239658>
    // Interestingly, the actual value does not even depend on the provided
value (uidHash)!

    // assertEquals("6a7f660d1b2d5b9869cf0ecee3a17e42", vertex.getID());
    // Passes (if uid is used instead)
  }
```

Can anyone confirm whether this is a bug?

Regards,

Salva

Reply via email to