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 explain error line for some #2657

Merged
merged 2 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
Next Next commit
feat: add explain error line for some
Signed-off-by: licho <lecho.sun@gmail.com>
  • Loading branch information
leechor committed Dec 16, 2023
commit 1808f042e11b5d94d05557f3ed82d11a3dd7d738
10 changes: 7 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 @@ -19,6 +19,7 @@

package org.dinky.explainer;

import cn.hutool.core.text.StrFormatter;
import org.dinky.assertion.Asserts;
import org.dinky.constant.FlinkSQLConstant;
import org.dinky.data.model.LineageRel;
Expand Down Expand Up @@ -209,7 +210,8 @@ 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 +266,8 @@ 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 +295,8 @@ 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
Loading