Uploaded image for project: 'Apache Hudi'
  1. Apache Hudi
  2. HUDI-6120

fetchAllLogsMergedFileSlice will read basefile which it does not expect

    XMLWordPrintableJSON

Details

    Description

      Check the code snippet of org.apache.hudi.common.table.view.AbstractTableFileSystemView#fetchAllLogsMergedFileSlice:

      private Option<FileSlice> fetchAllLogsMergedFileSlice(HoodieFileGroup fileGroup, String maxInstantTime) {
        List<FileSlice> fileSlices = fileGroup.getAllFileSlicesBeforeOn(maxInstantTime).collect(Collectors.toList());
        if (fileSlices.size() == 0) {
          return Option.empty();
        }
        if (fileSlices.size() == 1) {
          return Option.of(fileSlices.get(0));
        }
        final FileSlice latestSlice = fileSlices.get(0);
        FileSlice merged = new FileSlice(latestSlice.getPartitionPath(), latestSlice.getBaseInstantTime(),
            latestSlice.getFileId());
      
        // add log files from the latest slice to the earliest
        fileSlices.forEach(slice -> slice.getLogFiles().forEach(merged::addLogFile));
        return Option.of(merged);
      }

      if we only fetch one file slice, we will return the file slice with basefile, and then hudi-flink will create a SkipMergeIterator/MergeIterator which both reads basefile and logfiles for the split.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              lam167 Jianhui Dong
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: