Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add edit words suggestion #2658

Merged
merged 5 commits into from
Dec 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add explain error line for some (#2657)
* feat: add explain error line for some

Signed-off-by: licho <lecho.sun@gmail.com>

* Spotless Apply

---------

Signed-off-by: licho <lecho.sun@gmail.com>
Co-authored-by: leechor <leechor@users.noreply.github.com>
  • Loading branch information
leechor and leechor committed Dec 16, 2023
commit 4cf73217fa5df18696f268a04cec74dc8fb44ea5
16 changes: 13 additions & 3 deletions dinky-core/src/main/java/org/dinky/explainer/Explainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
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;

Expand Down Expand Up @@ -209,7 +210,10 @@ record = executor.explainSqlRecord(item.getValue());
}
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());
Expand Down Expand Up @@ -264,7 +268,10 @@ record = executor.explainSqlRecord(item.getValue());
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);
Expand Down Expand Up @@ -292,7 +299,10 @@ record = new SqlExplainResult();
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());
Expand Down