gemini-code-assist[bot] commented on code in PR #37036:
URL: https://github.com/apache/beam/pull/37036#discussion_r2600657683


##########
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:
   You make a valid point. While the DRY principle is generally good for 
maintainability, it's also important to balance it with readability and 
avoiding unnecessary abstraction, especially for very short and 
self-documenting code snippets like `Iterables.getOnlyElement()`. Given that 
the duplication is limited to two places within the same file, your decision to 
keep it as is, prioritizing immediate readability and avoiding potential 
over-abstraction, is perfectly reasonable. Thank you for the thoughtful 
explanation!



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