dnamaz commented on code in PR #37036:
URL: https://github.com/apache/beam/pull/37036#discussion_r2600646826


##########
runners/flink/src/main/java/org/apache/beam/runners/flink/FlinkStreamingTransformTranslators.java:
##########
@@ -183,33 +192,131 @@ public static String 
getCurrentTransformName(FlinkStreamingTranslationContext co
     return context.getCurrentTransform().getFullName();
   }
 
+  /** Returns the parallelism to use for source operators. */
+  private static int getSourceParallelism(FlinkStreamingTranslationContext 
context) {
+    int maxParallelism = context.getExecutionEnvironment().getMaxParallelism();
+    return maxParallelism > 0 ? maxParallelism : 
context.getExecutionEnvironment().getParallelism();
+  }
+
   // 
--------------------------------------------------------------------------------------------
   //  Transformation Implementations
   // 
--------------------------------------------------------------------------------------------
 
+  /** Common translation logic for unbounded sources. */
+  @SuppressWarnings("unchecked")
+  private static <T> void translateUnboundedSource(
+      UnboundedSource<T, ?> rawSource,
+      String transformName,
+      FlinkStreamingTranslationContext context) {
+
+    PCollection<T> output =
+        (PCollection<T>)
+            
Iterables.getOnlyElement(context.getCurrentTransform().getOutputs().values());

Review Comment:
   I considered this, but felt that extracting a 2-3 line helper for code 
that's only duplicated in two places within the same file would be 
over-abstraction. The Iterables.getOnlyElement() call is already 
self-documenting about the expected behavior. 
   @gemini-code-assist



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