use of org.apache.flink.streaming.util.TestExpandingSink in project flink by apache.
the class StreamGraphGeneratorTest method testAutoParallelismForExpandedTransformations.
@Test
public void testAutoParallelismForExpandedTransformations() {
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(2);
DataStream<Integer> sourceDataStream = env.fromElements(1, 2, 3);
// Parallelism is set to -1 (default parallelism identifier) to imitate the behavior of
// the table planner. Parallelism should be set automatically after translating.
sourceDataStream.sinkTo(new TestExpandingSink()).setParallelism(-1);
StreamGraph graph = env.getStreamGraph();
graph.getStreamNodes().forEach(node -> {
if (!node.getOperatorName().startsWith("Source")) {
assertEquals(2, node.getParallelism());
}
});
}
Aggregations