Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,13 @@ public class FileSystemViewHandler {

private final FileSystemViewManager viewManager;
private final Javalin app;
private final Configuration conf;
private final TimelineHandler instantHandler;
private final FileSliceHandler sliceHandler;
private final DataFileHandler dataFileHandler;

public FileSystemViewHandler(Javalin app, Configuration conf, FileSystemViewManager viewManager) throws IOException {
this.viewManager = viewManager;
this.app = app;
this.conf = conf;
this.instantHandler = new TimelineHandler(conf, viewManager);
this.sliceHandler = new FileSliceHandler(conf, viewManager);
this.dataFileHandler = new DataFileHandler(conf, viewManager);
Expand Down Expand Up @@ -94,7 +92,7 @@ private boolean isLocalViewBehind(Context ctx) {
}

if ((localTimeline.getInstants().count() == 0)
&& lastKnownInstantFromClient.equals(HoodieTimeline.INVALID_INSTANT_TS)) {
&& HoodieTimeline.INVALID_INSTANT_TS.equals(lastKnownInstantFromClient)) {
return false;
}

Expand Down Expand Up @@ -131,7 +129,7 @@ private boolean syncIfLocalViewBehind(Context ctx) {
}

private void writeValueAsString(Context ctx, Object obj) throws JsonProcessingException {
boolean prettyPrint = ctx.queryParam("pretty") != null ? true : false;
boolean prettyPrint = ctx.queryParam("pretty") != null;
long beginJsonTs = System.currentTimeMillis();
String result =
prettyPrint ? OBJECT_MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(obj) : OBJECT_MAPPER.writeValueAsString(obj);
Expand Down Expand Up @@ -267,7 +265,7 @@ private void registerFileSlicesAPI() {
ctx.validatedQueryParam(RemoteHoodieTableFileSystemView.BASEPATH_PARAM).getOrThrow(),
ctx.validatedQueryParam(RemoteHoodieTableFileSystemView.PARTITION_PARAM).getOrThrow(),
ctx.validatedQueryParam(RemoteHoodieTableFileSystemView.MAX_INSTANT_PARAM).getOrThrow(),
Boolean.valueOf(
Boolean.parseBoolean(
ctx.validatedQueryParam(RemoteHoodieTableFileSystemView.INCLUDE_FILES_IN_PENDING_COMPACTION_PARAM)
.getOrThrow()));
writeValueAsString(ctx, dtos);
Expand All @@ -294,7 +292,7 @@ private void registerFileSlicesAPI() {
}

private static boolean isRefreshCheckDisabledInQuery(Context ctxt) {
return Boolean.valueOf(ctxt.queryParam(RemoteHoodieTableFileSystemView.REFRESH_OFF));
return Boolean.parseBoolean(ctxt.queryParam(RemoteHoodieTableFileSystemView.REFRESH_OFF));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static class Config implements Serializable {
@Parameter(names = {"--server-port", "-p"}, description = " Server Port")
public Integer serverPort = 26754;

@Parameter(names = {"--view-storage", "-st"}, description = "View Storage Type. Defaut - SPILLABLE_DISK")
@Parameter(names = {"--view-storage", "-st"}, description = "View Storage Type. Default - SPILLABLE_DISK")
public FileSystemViewStorageType viewStorageType = FileSystemViewStorageType.SPILLABLE_DISK;

@Parameter(names = {"--max-view-mem-per-table", "-mv"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public List<DataFileDTO> getLatestDataFiles(String basePath, String partitionPat

public List<DataFileDTO> getLatestDataFile(String basePath, String partitionPath, String fileId) {
return viewManager.getFileSystemView(basePath).getLatestDataFile(partitionPath, fileId)
.map(DataFileDTO::fromHoodieDataFile).map(dto -> Arrays.asList(dto)).orElse(new ArrayList<>());
.map(DataFileDTO::fromHoodieDataFile).map(Arrays::asList).orElse(new ArrayList<>());
}

public List<DataFileDTO> getLatestDataFiles(String basePath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public List<FileSliceDTO> getLatestFileSlices(String basePath, String partitionP

public List<FileSliceDTO> getLatestFileSlice(String basePath, String partitionPath, String fileId) {
return viewManager.getFileSystemView(basePath).getLatestFileSlice(partitionPath, fileId)
.map(FileSliceDTO::fromFileSlice).map(dto -> Arrays.asList(dto)).orElse(new ArrayList<>());
.map(FileSliceDTO::fromFileSlice).map(Arrays::asList).orElse(new ArrayList<>());
}

public List<CompactionOpDTO> getPendingCompactionOperations(String basePath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public TimelineHandler(Configuration conf, FileSystemViewManager viewManager) th

public List<InstantDTO> getLastInstant(String basePath) {
return viewManager.getFileSystemView(basePath).getLastInstant().map(InstantDTO::fromInstant)
.map(dto -> Arrays.asList(dto)).orElse(new ArrayList<>());
.map(Arrays::asList).orElse(new ArrayList<>());
}

public TimelineDTO getTimeline(String basePath) {
Expand Down