Unverified Commit 9a3cb09e authored by Licho's avatar Licho Committed by GitHub

feat: add explain error line for some (#2657)

* feat: add explain error line for some Signed-off-by: 's avatarlicho <lecho.sun@gmail.com> * Spotless Apply --------- Signed-off-by: 's avatarlicho <lecho.sun@gmail.com> Co-authored-by: 's avatarleechor <leechor@users.noreply.github.com>
parent 4a932b74
......@@ -59,6 +59,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.StrFormatter;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
......@@ -209,7 +210,10 @@ public class Explainer {
}
executor.executeSql(item.getValue());
} catch (Exception e) {
String error = LogUtil.getError(e);
String error = StrFormatter.format(
"Exception in executing FlinkSQL:\n{}\n{}",
SqlUtil.addLineNumber(item.getValue()),
e.getMessage());
record.setError(error);
record.setExplainTrue(false);
record.setExplainTime(LocalDateTime.now());
......@@ -264,7 +268,10 @@ public class Explainer {
record.setParseTrue(true);
record.setExplainTrue(true);
} catch (Exception e) {
String error = LogUtil.getError(e);
String error = StrFormatter.format(
"Exception in executing FlinkSQL:\n{}\n{}",
SqlUtil.addLineNumber(item.getValue()),
e.getMessage());
record.setError(error);
record.setParseTrue(false);
record.setExplainTrue(false);
......@@ -292,7 +299,10 @@ public class Explainer {
record.setType("DATASTREAM");
record.setParseTrue(true);
} catch (Exception e) {
String error = LogUtil.getError(e);
String error = StrFormatter.format(
"Exception in executing FlinkSQL:\n{}\n{}",
SqlUtil.addLineNumber(item.getValue()),
e.getMessage());
record.setError(error);
record.setExplainTrue(false);
record.setExplainTime(LocalDateTime.now());
......
......@@ -19,7 +19,7 @@
import CodeShow from '@/components/CustomEditor/CodeShow';
import { SseData } from '@/models/Sse';
import {DataStudioTabsItemType, StateType, VIEW} from '@/pages/DataStudio/model';
import { DataStudioTabsItemType, StateType, VIEW } from '@/pages/DataStudio/model';
import { SSE_TOPIC } from '@/pages/DevOps/constants';
import { API_CONSTANTS } from '@/services/endpoints';
import { parseMilliSecondStr } from '@/utils/function';
......
This diff is collapsed.
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