[HUDI-1352] Add FileSystemView APIs to query pending clustering operations (#2202)
This commit is contained in:
@@ -20,6 +20,7 @@ package org.apache.hudi.timeline.service;
|
||||
|
||||
import org.apache.hudi.common.table.timeline.HoodieTimeline;
|
||||
import org.apache.hudi.common.table.timeline.dto.BaseFileDTO;
|
||||
import org.apache.hudi.common.table.timeline.dto.ClusteringOpDTO;
|
||||
import org.apache.hudi.common.table.timeline.dto.CompactionOpDTO;
|
||||
import org.apache.hudi.common.table.timeline.dto.FileGroupDTO;
|
||||
import org.apache.hudi.common.table.timeline.dto.FileSliceDTO;
|
||||
@@ -297,6 +298,12 @@ public class FileSystemViewHandler {
|
||||
ctx.queryParam(RemoteHoodieTableFileSystemView.PARTITION_PARAM,""));
|
||||
writeValueAsString(ctx, dtos);
|
||||
}, true));
|
||||
|
||||
app.get(RemoteHoodieTableFileSystemView.PENDING_CLUSTERING_FILEGROUPS, new ViewHandler(ctx -> {
|
||||
List<ClusteringOpDTO> dtos = sliceHandler.getFileGroupsInPendingClustering(
|
||||
ctx.validatedQueryParam(RemoteHoodieTableFileSystemView.BASEPATH_PARAM).getOrThrow());
|
||||
writeValueAsString(ctx, dtos);
|
||||
}, true));
|
||||
}
|
||||
|
||||
private static boolean isRefreshCheckDisabledInQuery(Context ctxt) {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package org.apache.hudi.timeline.service.handlers;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hudi.common.table.timeline.dto.ClusteringOpDTO;
|
||||
import org.apache.hudi.common.table.timeline.dto.CompactionOpDTO;
|
||||
import org.apache.hudi.common.table.timeline.dto.FileGroupDTO;
|
||||
import org.apache.hudi.common.table.timeline.dto.FileSliceDTO;
|
||||
@@ -93,6 +94,12 @@ public class FileSliceHandler extends Handler {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<ClusteringOpDTO> getFileGroupsInPendingClustering(String basePath) {
|
||||
return viewManager.getFileSystemView(basePath).getFileGroupsInPendingClustering()
|
||||
.map(fgInstant -> ClusteringOpDTO.fromClusteringOp(fgInstant.getLeft(), fgInstant.getRight()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public boolean refreshTable(String basePath) {
|
||||
viewManager.clearFileSystemView(basePath);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user