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


##########
examples/java/src/main/java/org/apache/beam/examples/ViewExample.java:
##########
@@ -99,12 +99,12 @@ public void processElement(
                 .withSideInput("citiesToCountries", citiesToCountriesView));
     // [END main_section]
 
-    output.apply("Log", ParDo.of(new LogOutput<>("Output: ")));
+    output.apply("Log", ParDo.of(new LogOutput("Output: ")));

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   If the Playground CI environment has issues with type inference or the 
diamond operator, it is better to provide explicit type arguments while keeping 
the utility class generic. This preserves the reusability of the `LogOutput` 
class.
   
   ```suggestion
       output.apply("Log", ParDo.of(new LogOutput<KV<String, String>>("Output: 
")));
   ```



##########
examples/java/src/main/java/org/apache/beam/examples/ViewExample.java:
##########
@@ -99,12 +99,12 @@ public void processElement(
                 .withSideInput("citiesToCountries", citiesToCountriesView));
     // [END main_section]
 
-    output.apply("Log", ParDo.of(new LogOutput<>("Output: ")));
+    output.apply("Log", ParDo.of(new LogOutput("Output: ")));
 
     pipeline.run();
   }
 
-  static class LogOutput<T> extends DoFn<T, T> {
+  static class LogOutput extends DoFn<KV<String, String>, KV<String, String>> {

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Changing `LogOutput` from a generic class to one hardcoded for `KV<String, 
String>` reduces its maintainability and reusability. It is generally better to 
keep such utility classes generic, especially in example code which serves as a 
reference for best practices.
   
   ```suggestion
     static class LogOutput<T> extends DoFn<T, T> {
   ```



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