@PublicEvolving
    public DataStreamSink<T> setUidHash(String uidHash) {
        if (!(transformation instanceof LegacySinkTransformation)) {
            throw new UnsupportedOperationException(
                    "Cannot set a custom UID hash on a non-legacy sink");
        }
        transformation.setUidHash(uidHash);
        return this;
    }
@Test
    void throwExceptionWhenSetUidWithNewSinkAPI() {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        assertThatThrownBy(
                        () ->
                                env.fromData(1, 2)
                                        .sinkTo(TestSinkV2.<Integer>newBuilder().build())
                                        .setUidHash("Test"))
                .isInstanceOf(UnsupportedOperationException.class);
    }