Skip to content

Commit

Permalink
Merge pull request edp963#2224 from IronJy/dev-0.3
Browse files Browse the repository at this point in the history
fix: format sql  with different utility functions
  • Loading branch information
xxxllluuu authored Jul 9, 2021
2 parents 8b54df7 + 13233f5 commit 2a89c94
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions server/src/main/java/edp/core/utils/SqlUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1079,9 +1079,18 @@ public String getJdbcUrl() {
return this.jdbcSourceInfo.getJdbcUrl();
}

public static String formatSql(String sql) {
public String formatSql(String sql) {
try {
return SQLUtils.formatMySql(sql);
switch (dataTypeEnum) {
case ORACLE:
return SQLUtils.formatOracle(sql);
case MYSQL:
return SQLUtils.formatMySql(sql);
case HIVE2:
return SQLUtils.formatHive(sql);
default:
return sql;
}
} catch (Exception e) {
// ignore
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public T call() {
Set<String> queryFromsAndJoins = SqlUtils.getQueryFromsAndJoins(sql);
if (log) {
logger.info("Task({}) sheet worker(name:{}, sheetNo:{}, sheetName:{}) query start sql:{}, md5:{}",
context.getTaskKey(), context.getName(), context.getSheetNo(), context.getSheet().getSheetName(), SqlUtils.formatSql(sql), md5);
context.getTaskKey(), context.getName(), context.getSheetNo(), context.getSheet().getSheetName(), utils.formatSql(sql), md5);
}

final AtomicInteger count = new AtomicInteger(0);
Expand Down

0 comments on commit 2a89c94

Please sign in to comment.