zentol commented on code in PR #20757:
URL: https://github.com/apache/flink/pull/20757#discussion_r966821506


##########
flink-core/src/main/java/org/apache/flink/api/connector/source/SourceReaderContext.java:
##########
@@ -63,4 +63,11 @@ public interface SourceReaderContext {
      * @see UserCodeClassLoader
      */
     UserCodeClassLoader getUserCodeClassLoader();
+
+    /**
+     * Get the current parallelism of this Source.
+     *
+     * @return the parallelism of the Source.
+     */
+    int currentParallelism();

Review Comment:
   I'm not sure.
   
   It seems unlikely that there are implementations of this class, and if there 
are they should be notified about this additional method in case and reader 
they use was updated to already rely on it.
   
   While adding a default method is neat in terms of source compatibility, you 
either:
   a) return some static count, which might break behavior (maybe right away, 
maybe at some point in the future)
   b) thrown an exception, which would make it technically source compatible 
(urgh) but not in practice.
   
   I'm just annoyed that we yet again failed to wrap all this super common 
metadata (parallelism, attempt number etc etc) into a common structure that can 
be shared across the reader context and runtime context, and now end up having 
to copy things over one getter at a time.



-- 
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

Reply via email to