Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/3117#discussion_r96222455
--- Diff:
flink-streaming-java/src/test/java/org/apache/flink/streaming/graph/StreamingJobGraphGeneratorNodeHashTest.java
---
@@ -422,6 +425,43 @@ public void
testManualHashAssignmentForStartNodeInInChain() throws Exception {
env.getStreamGraph().getJobGraph();
}
+ @Test
+ public void testUserProvidedHashing() {
+ StreamExecutionEnvironment env =
StreamExecutionEnvironment.createLocalEnvironment();
+
+ List<String> userHashes =
Arrays.asList("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
+
+ env.addSource(new NoOpSourceFunction(),
"src").provideAdditionalNodeHash(userHashes.get(0))
+ .map(new NoOpMapFunction())
+ .filter(new NoOpFilterFunction())
+ .keyBy(new NoOpKeySelector())
+ .reduce(new
NoOpReduceFunction()).name("reduce").provideAdditionalNodeHash(userHashes.get(1));
+
+ StreamGraph streamGraph = env.getStreamGraph();
+ int idx = 1;
+ for (JobVertex jobVertex :
streamGraph.getJobGraph().getVertices()) {
+
Assert.assertEquals(jobVertex.getIdAlternatives().get(1).toString(),
userHashes.get(idx));
+ --idx;
+ }
+ }
+
+ @Test
+ public void testUserProvidedHashingOnChainNotSupported() {
+ StreamExecutionEnvironment env =
StreamExecutionEnvironment.createLocalEnvironment();
+
+ env.addSource(new NoOpSourceFunction(),
"src").provideAdditionalNodeHash("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
+ .map(new
NoOpMapFunction()).provideAdditionalNodeHash("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")
--- End diff --
the fact that this fails the job should probably be documented in the
javadocs of ```provideAdditionalNodeHash```.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---