Skip to content

Commit 6b8d51b

Browse files
authored
[Fix]Fixed the JAR task could not use set (#3057)
1 parent ed1e695 commit 6b8d51b

File tree

4 files changed

+23
-28
lines changed

4 files changed

+23
-28
lines changed

dinky-admin/src/main/java/org/dinky/aop/exception/WebExceptionHandler.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.dinky.data.enums.Status;
2323
import org.dinky.data.exception.BusException;
2424
import org.dinky.data.result.Result;
25-
import org.dinky.utils.I18n;
2625

2726
import org.apache.commons.lang3.StringUtils;
2827

@@ -47,7 +46,6 @@
4746

4847
import cn.dev33.satoken.exception.NotLoginException;
4948
import cn.hutool.core.map.MapUtil;
50-
import cn.hutool.core.util.StrUtil;
5149
import lombok.extern.slf4j.Slf4j;
5250

5351
/**
@@ -64,9 +62,6 @@ public class WebExceptionHandler {
6462
@ResponseBody
6563
public Result<Void> busException(BusException e) {
6664
log.error("BusException:", e);
67-
if (StrUtil.isEmpty(e.getMsg())) {
68-
return Result.failed(I18n.getMessage(e.getCode(), e.getMessage()));
69-
}
7065
return Result.failed(e.getMsg());
7166
}
7267

dinky-common/src/main/java/org/dinky/data/exception/BusException.java

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import org.dinky.data.enums.Status;
2323

24-
import cn.hutool.core.exceptions.ExceptionUtil;
2524
import cn.hutool.core.util.StrUtil;
2625
import lombok.Getter;
2726
import lombok.Setter;
@@ -43,47 +42,45 @@ public class BusException extends RuntimeException {
4342
private static final long serialVersionUID = -2955156471454043812L;
4443

4544
/** 异常信息的code码 */
46-
private String code;
47-
48-
/** 如果有值得话,将不会取i18n里面的错误信息 */
49-
private String msg;
45+
private Status code;
5046

5147
/** 异常信息的参数 */
5248
private Object[] errorArgs;
5349

50+
/** 如果有值得话,将不会取i18n里面的错误信息 */
51+
private String msg;
52+
5453
public BusException(String message) {
5554
super(message);
5655
setMsg(message);
5756
}
5857

5958
public BusException(Status status) {
6059
super(status.getMessage());
61-
setCode(String.valueOf(status.getCode()));
60+
setCode(status);
6261
setMsg(status.getMessage());
6362
}
6463

6564
public BusException(Status status, Object... errorArgs) {
6665
super(status.getMessage());
67-
setCode(String.valueOf(status.getCode()));
66+
setCode(status);
6867
setMsg(StrUtil.format(status.getMessage(), errorArgs));
6968
}
7069

71-
public BusException(String message, Object... args) {
72-
super();
73-
setCode(message);
74-
setErrorArgs(args);
75-
}
76-
7770
/**
7871
* An exception that gets the error message through i 18n
7972
*
80-
* @param code code
73+
* @param message code
8174
* @param e e
8275
* @return {@link BusException}
8376
*/
84-
public static BusException valueOf(String code, Throwable e) {
85-
String errMsg = ExceptionUtil.stacktraceToString(e);
86-
log.error(errMsg);
77+
public static BusException valueOf(String message, Throwable e) {
78+
log.error(message, e);
79+
return new BusException(message + e.getMessage());
80+
}
81+
82+
public static BusException valueOf(Status code, Throwable e) {
83+
log.error(code.getMessage(), e);
8784
return new BusException(code, e.getMessage());
8885
}
8986

@@ -94,7 +91,7 @@ public static BusException valueOf(String code, Throwable e) {
9491
* @param errorArgs errorArgs
9592
* @return {@link BusException}
9693
*/
97-
public static BusException valueOf(String code, Object... errorArgs) {
94+
public static BusException valueOf(Status code, Object... errorArgs) {
9895
return new BusException(code, errorArgs);
9996
}
10097

@@ -104,7 +101,7 @@ public static BusException valueOf(String code, Object... errorArgs) {
104101
* @param msg msg
105102
* @return {@link BusException}
106103
*/
107-
public static BusException valueOfMsg(String msg) {
104+
public static BusException valueOf(String msg) {
108105
return new BusException(msg);
109106
}
110107
}

dinky-core/src/main/java/org/dinky/job/JobManager.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
import org.dinky.utils.SqlUtil;
6666
import org.dinky.utils.URLUtils;
6767

68+
import org.apache.flink.configuration.Configuration;
6869
import org.apache.flink.configuration.CoreOptions;
6970
import org.apache.flink.configuration.DeploymentOptions;
7071
import org.apache.flink.configuration.PipelineOptions;
@@ -256,12 +257,12 @@ public JobResult executeJarSql(String statement) throws Exception {
256257
ready();
257258
JobJarStreamGraphBuilder jobJarStreamGraphBuilder = JobJarStreamGraphBuilder.build(this);
258259
StreamGraph streamGraph = jobJarStreamGraphBuilder.getJarStreamGraph(statement, getDinkyClassLoader());
260+
Configuration configuration =
261+
executor.getCustomTableEnvironment().getConfig().getConfiguration();
259262
if (Asserts.isNotNullString(config.getSavePointPath())) {
260263
streamGraph.setSavepointRestoreSettings(SavepointRestoreSettings.forPath(
261264
config.getSavePointPath(),
262-
executor.getStreamExecutionEnvironment()
263-
.getConfiguration()
264-
.get(SavepointConfigOptions.SAVEPOINT_IGNORE_UNCLAIMED_STATE)));
265+
configuration.get(SavepointConfigOptions.SAVEPOINT_IGNORE_UNCLAIMED_STATE)));
265266
}
266267
try {
267268
if (!useGateway) {
@@ -282,7 +283,7 @@ public JobResult executeJarSql(String statement) throws Exception {
282283
}
283284
} else {
284285
GatewayResult gatewayResult;
285-
config.addGatewayConfig(executor.getSetConfig());
286+
config.addGatewayConfig(configuration);
286287
if (runMode.isApplicationMode()) {
287288
gatewayResult = Gateway.build(config.getGatewayConfig()).submitJar(getUdfPathContextHolder());
288289
} else {

docs/docs/user_guide/studio/flink_sql_task_devlop.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ EXECUTE JAR WITH (
170170
**样例代码**
171171

172172
```sql
173+
set 'execution.checkpointing.interval'='21 s';
174+
173175
EXECUTE JAR WITH (
174176
'uri'='rs:/jar/flink/demo/SocketWindowWordCount.jar',
175177
'main-class'='org.apache.flink.streaming.examples.socket',

0 commit comments

Comments
 (0)