mirror of
https://github.com/dataease/dataease.git
synced 2026-05-14 21:12:33 +08:00
fix: 修复 calcite 转 SQL Server CONCAT 异常 #16860
This commit is contained in:
@@ -13,6 +13,7 @@ import org.apache.calcite.sql.SqlDialect;
|
||||
import org.apache.calcite.sql.SqlNode;
|
||||
import org.apache.calcite.sql.dialect.*;
|
||||
import org.apache.calcite.sql.parser.SqlParser;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -143,7 +144,11 @@ public abstract class Provider {
|
||||
}
|
||||
SqlParser parser = SqlParser.create(sql, SqlParser.Config.DEFAULT.withLex(Lex.JAVA));
|
||||
SqlNode sqlNode = parser.parseStmt();
|
||||
return sqlNode.toSqlString(getDialect(value)).toString();
|
||||
String dialect = sqlNode.toSqlString(getDialect(value)).toString();
|
||||
if (StringUtils.equalsIgnoreCase(value.getType(), "sqlServer")) {
|
||||
dialect = dialect.replaceAll("\\[CONCAT]", "CONCAT");
|
||||
}
|
||||
return dialect;
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(e.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user