perf(hudi-query): 优化hudi时间线的扫描速度

This commit is contained in:
v-zhangjc9
2024-05-22 13:11:50 +08:00
parent 2b7b7f838c
commit bff18280f3
7 changed files with 261 additions and 82 deletions

View File

@@ -1,5 +1,6 @@
package com.lanyuanxiaoyao.service.configuration.entity.hudi;
import cn.hutool.core.util.StrUtil;
import java.util.Comparator;
import org.eclipse.collections.api.factory.Maps;
import org.eclipse.collections.api.map.ImmutableMap;
@@ -18,11 +19,6 @@ public class HudiInstant implements Comparable<HudiInstant> {
Comparator.comparing(HudiInstant::getTimestamp)
.thenComparing(ACTION_COMPARATOR)
.thenComparing(HudiInstant::getState);
private static String getComparableAction(String action) {
return COMPARABLE_ACTIONS.getOrDefault(action, action);
}
private String action;
// REQUESTED, INFLIGHT, COMPLETED, INVALID
private String state;
@@ -43,24 +39,49 @@ public class HudiInstant implements Comparable<HudiInstant> {
this.type = type;
}
public HudiInstant(String action, String state, String timestamp, String fileName, Long fileTime, String type) {
this.action = action;
this.state = state;
this.timestamp = timestamp;
this.fileName = fileName;
this.fileTime = fileTime;
this.type = type;
}
private static String getComparableAction(String action) {
return COMPARABLE_ACTIONS.getOrDefault(action, action);
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public String getFileName() {
return fileName;
}
public String getType() {
return type;
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Long getFileTime() {
@@ -71,15 +92,17 @@ public class HudiInstant implements Comparable<HudiInstant> {
this.fileTime = fileTime;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String toString() {
return "HudiInstant{" +
"action='" + action + '\'' +
", state='" + state + '\'' +
", timestamp='" + timestamp + '\'' +
", fileName='" + fileName + '\'' +
", type='" + type + '\'' +
'}';
return StrUtil.format("{},{},{},{},{},{}", action, state, timestamp, fileName, fileTime, type);
}
@Override