You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by yi...@apache.org on 2024/05/15 11:59:04 UTC

(hudi) 11/21: [HUDI-7720] Fix HoodieTableFileSystemView NPE in fetchAllStoredFileGroups (#11161)

This is an automated email from the ASF dual-hosted git repository.

yihua pushed a commit to branch branch-0.x
in repository https://gitbox.apache.org/repos/asf/hudi.git

commit f7ec3878cc810c09bfe80bcf525f0f1b86b5754f
Author: xuzifu666 <12...@qq.com>
AuthorDate: Tue May 7 16:39:52 2024 +0800

    [HUDI-7720] Fix HoodieTableFileSystemView NPE in fetchAllStoredFileGroups (#11161)
---
 .../org/apache/hudi/common/table/view/HoodieTableFileSystemView.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hudi-common/src/main/java/org/apache/hudi/common/table/view/HoodieTableFileSystemView.java b/hudi-common/src/main/java/org/apache/hudi/common/table/view/HoodieTableFileSystemView.java
index baa75a3ac3a..5e7e0ddcb87 100644
--- a/hudi-common/src/main/java/org/apache/hudi/common/table/view/HoodieTableFileSystemView.java
+++ b/hudi-common/src/main/java/org/apache/hudi/common/table/view/HoodieTableFileSystemView.java
@@ -308,6 +308,11 @@ public class HoodieTableFileSystemView extends IncrementalTimelineSyncFileSystem
    */
   @Override
   Stream<HoodieFileGroup> fetchAllStoredFileGroups(String partition) {
+    List<HoodieFileGroup> hoodieFileGroups = partitionToFileGroupsMap.get(partition);
+    if (hoodieFileGroups == null || hoodieFileGroups.size() == 0) {
+      LOG.warn("partition: {} is not available in store");
+      return Stream.empty();
+    }
     final List<HoodieFileGroup> fileGroups = new ArrayList<>(partitionToFileGroupsMap.get(partition));
     return fileGroups.stream();
   }