diff --git a/conf/config.properties b/conf/config.properties index dbed3da2ea..2d6fe6420c 100644 --- a/conf/config.properties +++ b/conf/config.properties @@ -188,7 +188,7 @@ restIp=0.0.0.0 restPort=6666 # 是否启用 rest 服务 -enableRestService=false +enableRestService=true # 乱序数据 margin, 单位是秒 disorderMargin=10 diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/engine/shared/Result.java b/core/src/main/java/cn/edu/tsinghua/iginx/engine/shared/Result.java index 6631c67db4..553297f2f9 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/engine/shared/Result.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/engine/shared/Result.java @@ -52,7 +52,7 @@ public class Result { private long jobId; private List jobIdList; - private String configValue; + private Map configs; private String exportByteStreamDir; @@ -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); diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/sql/statement/ShowConfigStatement.java b/core/src/main/java/cn/edu/tsinghua/iginx/sql/statement/ShowConfigStatement.java index c72b8c456a..a5221df0eb 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/sql/statement/ShowConfigStatement.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/sql/statement/ShowConfigStatement.java @@ -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); diff --git a/session/src/main/java/cn/edu/tsinghua/iginx/session/SessionExecuteSqlResult.java b/session/src/main/java/cn/edu/tsinghua/iginx/session/SessionExecuteSqlResult.java index a680efd94d..3003f2a189 100644 --- a/session/src/main/java/cn/edu/tsinghua/iginx/session/SessionExecuteSqlResult.java +++ b/session/src/main/java/cn/edu/tsinghua/iginx/session/SessionExecuteSqlResult.java @@ -43,7 +43,7 @@ public class SessionExecuteSqlResult { private long jobId; private JobState jobState; private List jobIdList; - private String configValue; + private Map configs; private String loadCsvPath; private List sessionIDs; @@ -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(); @@ -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: @@ -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"; } @@ -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> 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) { diff --git a/thrift/src/main/proto/rpc.thrift b/thrift/src/main/proto/rpc.thrift index 2c5c56278e..f5bd1aaf0e 100644 --- a/thrift/src/main/proto/rpc.thrift +++ b/thrift/src/main/proto/rpc.thrift @@ -382,7 +382,7 @@ struct ExecuteSqlResp { 22: optional i64 jobId 23: optional JobState jobState 24: optional list jobIdList - 25: optional string configValue + 25: optional map configs 26: optional string loadCsvPath 27: optional list sessionIDList 28: optional map rules