AHeise commented on a change in pull request #14056: URL: https://github.com/apache/flink/pull/14056#discussion_r522375450
########## File path: flink-streaming-java/src/test/java/org/apache/flink/streaming/api/transformations/MultipleInputTransformationTest.java ########## @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.streaming.api.transformations; + +import org.apache.flink.api.common.eventtime.WatermarkStrategy; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.connector.source.lib.NumberSequenceSource; + +import org.junit.Test; + +import java.nio.charset.StandardCharsets; +import java.util.Random; + +import static org.apache.flink.streaming.api.graph.StreamGraphGeneratorTest.unsupportedOperatorFactory; +import static org.junit.Assert.assertTrue; + +/** + * {@link MultipleInputTransformation} test. + */ +public class MultipleInputTransformationTest { + + @Test + public void testNaming() { + Random random = new Random(); + String baseName = getString(random); + MultipleInputTransformation<Long> transformation = + new MultipleInputTransformation<>(baseName, unsupportedOperatorFactory(), TypeInformation.of(Long.class), 1); + for (int i = 0; i < 10; i++) { + transformation.addInput(new SourceTransformation<>(getString(random), + new NumberSequenceSource(0, 1), + WatermarkStrategy.noWatermarks(), + TypeInformation.of(Long.class), + 1)); + } + assertTrue(transformation.getName().contains(baseName)); + transformation.getInputs().forEach(input -> assertTrue(transformation.getName().contains(input.getName()))); + System.out.println(transformation.getName()); Review comment: Should be removed. ########## File path: flink-streaming-java/src/test/java/org/apache/flink/streaming/api/transformations/MultipleInputTransformationTest.java ########## @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.streaming.api.transformations; + +import org.apache.flink.api.common.eventtime.WatermarkStrategy; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.connector.source.lib.NumberSequenceSource; + +import org.junit.Test; + +import java.nio.charset.StandardCharsets; +import java.util.Random; + +import static org.apache.flink.streaming.api.graph.StreamGraphGeneratorTest.unsupportedOperatorFactory; +import static org.junit.Assert.assertTrue; + +/** + * {@link MultipleInputTransformation} test. + */ +public class MultipleInputTransformationTest { + + @Test + public void testNaming() { + Random random = new Random(); + String baseName = getString(random); + MultipleInputTransformation<Long> transformation = + new MultipleInputTransformation<>(baseName, unsupportedOperatorFactory(), TypeInformation.of(Long.class), 1); + for (int i = 0; i < 10; i++) { + transformation.addInput(new SourceTransformation<>(getString(random), + new NumberSequenceSource(0, 1), + WatermarkStrategy.noWatermarks(), + TypeInformation.of(Long.class), + 1)); + } + assertTrue(transformation.getName().contains(baseName)); Review comment: I like that you just test for containment. ########## File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/MultipleInputTransformation.java ########## @@ -40,4 +42,12 @@ public MultipleInputTransformation( inputs.add(input); return this; } + + @Override + public String getName() { + return String.format( + "%s [%s]", Review comment: In the old chaining way with only one input, we have `source -> op1 -> op2` in the log and web UI. If I get this formatting correctly, we would have `op1 [source1, source2] -> op2` now. I'd naively assume that it's easier for users to read `[source1, source2] -> op1 -> op2`. WDYT? Ofc, it kinda assumes that chaining is printed with " -> " in JobGraphGenerator, which might be less ideal. Also, how does it look for no source? Would it print `op []`? I guess we should have a special treatment for non-chained inputs. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
