Skip to content

Commit

Permalink
fix problems when resolving conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Cauchy-NY committed May 8, 2024
1 parent abbd99f commit 249d929
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion conf/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ restIp=0.0.0.0
restPort=6666

# 是否启用 rest 服务
enableRestService=false
enableRestService=true

# 乱序数据 margin, 单位是秒
disorderMargin=10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class Result {
private long jobId;
private List<Long> jobIdList;

private String configValue;
private Map<String, String> configs;

private String exportByteStreamDir;

Expand Down Expand Up @@ -169,7 +169,7 @@ public ExecuteSqlResp getExecuteSqlResp() {
resp.setJobId(jobId);
resp.setJobState(jobState);
resp.setJobIdList(jobIdList);
resp.setConfigValue(configValue);
resp.setConfigs(configs);
// INFILE AS CSV
resp.setLoadCsvPath(loadCSVPath);
resp.setSessionIDList(sessionIDs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public void execute(RequestContext ctx) throws StatementExecutionException {
}

Result result = new Result(RpcUtils.SUCCESS);
result.setConfigs(configs);
ctx.setResult(result);
} catch (NoSuchFieldException e) {
String errMsg = String.format("no such field, field=%s", configName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class SessionExecuteSqlResult {
private long jobId;
private JobState jobState;
private List<Long> jobIdList;
private String configValue;
private Map<String, String> configs;
private String loadCsvPath;
private List<Long> sessionIDs;

Expand Down Expand Up @@ -104,7 +104,7 @@ public SessionExecuteSqlResult(ExecuteSqlResp resp) {
this.jobIdList = resp.getJobIdList();
break;
case ShowConfig:
this.configValue = resp.getConfigValue();
this.configs = resp.getConfigs();
break;
case LoadCsv:
this.loadCsvPath = resp.getLoadCsvPath();
Expand Down Expand Up @@ -185,6 +185,8 @@ public String getResultInString(boolean needFormatTime, String timePrecision) {
return buildShowEligibleJobResult();
case ShowSessionID:
return buildShowSessionIDResult();
case ShowConfig:
return buildShowConfigResult();
case ShowRules:
return buildShowRulesResult();
case GetReplicaNum:
Expand All @@ -195,8 +197,6 @@ public String getResultInString(boolean needFormatTime, String timePrecision) {
return "job id: " + jobId;
case ShowJobStatus:
return "Job status: " + jobState;
case ShowConfig:
return "config value: " + configValue + "\n";
default:
return "No data to print." + "\n";
}
Expand Down Expand Up @@ -433,6 +433,21 @@ private String buildShowSessionIDResult() {
return builder.toString();
}

private String buildShowConfigResult() {
StringBuilder builder = new StringBuilder();
if (configs != null) {
builder.append("Config Info:").append("\n");
List<List<String>> cache = new ArrayList<>();
cache.add(new ArrayList<>(Arrays.asList("ConfigName", "ConfigValue")));
configs.forEach(
(name, value) -> {
cache.add(new ArrayList<>(Arrays.asList(name, value)));
});
builder.append(FormatUtils.formatResult(cache));
}
return builder.toString();
}

private String buildShowRulesResult() {
StringBuilder builder = new StringBuilder();
if (rules != null) {
Expand Down
2 changes: 1 addition & 1 deletion thrift/src/main/proto/rpc.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ struct ExecuteSqlResp {
22: optional i64 jobId
23: optional JobState jobState
24: optional list<i64> jobIdList
25: optional string configValue
25: optional map<string, string> configs
26: optional string loadCsvPath
27: optional list<i64> sessionIDList
28: optional map<string, bool> rules
Expand Down

0 comments on commit 249d929

Please sign in to comment.