reswqa commented on code in PR #24422: URL: https://github.com/apache/flink/pull/24422#discussion_r1528192344
########## flink-process-function-parent/flink-process-function-api/src/main/java/org/apache/flink/process/api/stream/BroadcastStream.java: ########## @@ -0,0 +1,68 @@ +/* + * 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.process.api.stream; + +import org.apache.flink.annotation.Experimental; +import org.apache.flink.api.java.functions.KeySelector; +import org.apache.flink.process.api.function.TwoInputBroadcastStreamProcessFunction; + +/** This interface represents a stream that each parallel task processes the same data. */ +@Experimental +public interface BroadcastStream<T> { + /** + * Apply a two input operation to this and other {@link KeyedPartitionStream}. + * + * @param other {@link KeyedPartitionStream} to perform operation with two input. + * @param processFunction to perform operation. + * @return new stream with this operation. + */ + <K, T_OTHER, OUT> NonKeyedPartitionStream<OUT> connectAndProcess( + KeyedPartitionStream<K, T_OTHER> other, + TwoInputBroadcastStreamProcessFunction<T_OTHER, T, OUT> processFunction); + + /** + * Apply a two input operation to this and other {@link NonKeyedPartitionStream}. + * + * @param other {@link NonKeyedPartitionStream} to perform operation with two input. + * @param processFunction to perform operation. + * @return new stream with this operation. + */ + <T_OTHER, OUT> NonKeyedPartitionStream<OUT> connectAndProcess( + NonKeyedPartitionStream<T_OTHER> other, + TwoInputBroadcastStreamProcessFunction<T_OTHER, T, OUT> processFunction); + + /** + * Apply a two input operation to this and other {@link KeyedPartitionStream}. + * + * <p>This method is used to avoid shuffle after applying the process function. It is required + * that for the record from non-broadcast input, the new {@link KeySelector} must extract the + * same key as the original {@link KeySelector}s on the {@link KeyedPartitionStream}. For the + * record from broadcast input, the output key from keyed partition itself instead of new key + * selector, so it is safe already. Review Comment: Updated. -- 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. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org