hudi-agent commented on code in PR #17591:
URL: https://github.com/apache/hudi/pull/17591#discussion_r3430731474


##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/client/common/HoodieFlinkEngineContext.java:
##########
@@ -112,6 +113,13 @@ public <T> HoodieData<T> parallelize(List<T> data, int 
parallelism) {
     return HoodieListData.eager(data);
   }
 
+  @Override
+  public <T> HoodieData<T> union(List<HoodieData<T>> dataList) {
+    List<T> allData = new ArrayList<>();
+    dataList.forEach(hoodieData -> allData.addAll(hoodieData.collectAsList()));
+    return HoodieListData.eager(allData);

Review Comment:
   🤖 nit: the mutable-accumulator + `forEach` pattern could be simplified to 
`dataList.stream().flatMap(d -> 
d.collectAsList().stream()).collect(Collectors.toList())`, which is more 
idiomatic Java. The same pattern appears identically in 
`HoodieJavaEngineContext` and `HoodieLocalEngineContext`.
   
   <sub><i>- AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



##########
hudi-common/src/main/java/org/apache/hudi/common/engine/HoodieEngineContext.java:
##########
@@ -80,6 +80,8 @@ public <T> HoodieData<T> parallelize(List<T> data) {
     }
   }
 
+  public abstract <T> HoodieData<T> union(List<HoodieData<T>> dataList);

Review Comment:
   🤖 Adding `union` as a new abstract method here means every concrete subclass 
needs an implementation, but `ExecutorServiceBasedEngineContext` (in this same 
package) doesn't appear to override it on this branch — that should fail 
compilation. Could you add an implementation there (the same 
`HoodieListData.eager(allData)` body used in `HoodieLocalEngineContext` would 
fit, since it's also list-backed)?
   
   <sub><i>- AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



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