Unverified Commit 2ea701a4 authored by Licho's avatar Licho Committed by GitHub

feat: add exception sql prompt line number (#1870)

* feat: add exception sql prompt line number * Spotless Apply --------- Co-authored-by: 's avatarleechor <leechor@users.noreply.github.com>
parent d5ab32d3
...@@ -625,7 +625,9 @@ public class JobManager { ...@@ -625,7 +625,9 @@ public class JobManager {
success(); success();
} }
} catch (Exception e) { } catch (Exception e) {
String error = LogUtil.getError("Exception in executing FlinkSQL:\n" + currentSql, e); String error =
LogUtil.getError(
"Exception in executing FlinkSQL:\n" + addLineNumber(currentSql), e);
job.setEndTime(LocalDateTime.now()); job.setEndTime(LocalDateTime.now());
job.setStatus(Job.JobStatus.FAILED); job.setStatus(Job.JobStatus.FAILED);
job.setError(error); job.setError(error);
...@@ -637,6 +639,18 @@ public class JobManager { ...@@ -637,6 +639,18 @@ public class JobManager {
return job.getJobResult(); return job.getJobResult();
} }
public String addLineNumber(String input) {
String[] lines = input.split("\n");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < lines.length; i++) {
sb.append(String.format("%-4d", i + 1));
sb.append(" ");
sb.append(lines[i]);
sb.append("\n");
}
return sb.toString();
}
private GatewayResult submitByGateway(List<String> inserts) { private GatewayResult submitByGateway(List<String> inserts) {
GatewayResult gatewayResult = null; GatewayResult gatewayResult = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment