codenohup commented on code in PR #26284:
URL: https://github.com/apache/flink/pull/26284#discussion_r2020862701


##########
flink-datastream-api/src/main/java/org/apache/flink/datastream/api/stream/NonKeyedPartitionStream.java:
##########
@@ -41,6 +42,20 @@ public interface NonKeyedPartitionStream<T> extends 
DataStream {
     <OUT> ProcessConfigurableAndNonKeyedPartitionStream<OUT> process(
             OneInputStreamProcessFunction<T, OUT> processFunction);
 
+    /**
+     * Adds a type information hint about the return type of this operator. 
This method can be used
+     * in cases where Flink cannot determine automatically what the produced 
type of a function is.
+     * That can be the case if the function uses generic type variables in the 
return type that
+     * cannot be inferred from the input type.
+     *
+     * <p>In most cases, the methods {@link #returns(Class)} and {@link 
#returns(TypeHint)} are
+     * preferable.
+     *
+     * @param typeInfo type information as a return type hint
+     * @return This operator with a given return type hint.
+     */
+    NonKeyedPartitionStream<T> returns(TypeInformation<T> typeInfo);

Review Comment:
   > Can it be just part of datastream interface? Then it will extend all other 
streams by default.
   
   Thank you for the reminder. You can add the `withReturnType` method to the 
`ProcessConfigurable` interface, as it proves to be useful in most scenarios. 
Regarding situations with two output streams, users can obtain both streams 
individually and then apply the `withReturnType` method to each. Here's an 
example to illustrate:
   ```
   
NonKeyedPartitionStream.ProcessConfigurableAndTwoNonKeyedPartitionStream<Integer,
 String>
                   twoOutputStream = ...;
   twoOutputStream.getFirst().withReturnType(TypeDescriptor.INT).process(...);
   
twoOutputStream.getSecond().withReturnType(TypeDescriptor.String).process(...);
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to