You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "lokeshj1703 (via GitHub)" <gi...@apache.org> on 2023/04/24 05:24:44 UTC

[GitHub] [hudi] lokeshj1703 commented on a diff in pull request #8480: [HUDI-6090] Optimise payload size for list of FileGroupDTO

lokeshj1703 commented on code in PR #8480:
URL: https://github.com/apache/hudi/pull/8480#discussion_r1174787456


##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/dto/FileGroupDTO.java:
##########
@@ -46,17 +49,50 @@ public class FileGroupDTO {
   TimelineDTO timeline;
 
   public static FileGroupDTO fromFileGroup(HoodieFileGroup fileGroup) {
+    return fromFileGroup(fileGroup, true);
+  }
+
+  public static List<FileGroupDTO> fromFileGroup(List<HoodieFileGroup> fileGroups) {
+    if (fileGroups.isEmpty()) {
+      return Collections.emptyList();
+    }
+
+    List<FileGroupDTO> fileGroupDTOs = fileGroups.stream()
+        .map(fg -> FileGroupDTO.fromFileGroup(fg, false)).collect(Collectors.toList());
+    // Timeline exists only in the first file group DTO. Optimisation to reduce payload size.
+    fileGroupDTOs.set(0, FileGroupDTO.fromFileGroup(fileGroups.get(0), true));
+    return fileGroupDTOs;
+  }
+
+  public static HoodieFileGroup toFileGroup(FileGroupDTO dto, HoodieTableMetaClient metaClient) {
+    return toFileGroup(dto, metaClient, null);
+  }
+
+  public static Stream<HoodieFileGroup> toFileGroup(List<FileGroupDTO> dtos, HoodieTableMetaClient metaClient) {
+    if (dtos.isEmpty()) {
+      return Stream.empty();

Review Comment:
   If there are no filegroups to return for the timeline server. If no filegroup matches the conditions, then it could be empty.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org