[fix][headless] Solve the problem of SQL execution error when alias is Chinese (#2039)
Some checks are pending
supersonic CentOS CI / build (21) (push) Waiting to run
supersonic mac CI / build (21) (push) Waiting to run
supersonic ubuntu CI / build (21) (push) Waiting to run
supersonic windows CI / build (21) (push) Waiting to run

This commit is contained in:
Hwwwww
2025-02-09 22:59:35 +08:00
committed by GitHub
parent eef7b3c443
commit a8157ee769
4 changed files with 74 additions and 0 deletions

View File

@@ -68,6 +68,8 @@ public class SqlQueryParser implements QueryParser {
ontologyQuery.setAggOption(sqlQueryAggOption);
convertNameToBizName(queryStatement);
// Solve the problem of SQL execution error when alias is Chinese
aliasesWithBackticks(queryStatement);
rewriteOrderBy(queryStatement);
// fill sqlQuery
@@ -88,6 +90,12 @@ public class SqlQueryParser implements QueryParser {
log.info("parse sqlQuery [{}] ", sqlQuery);
}
private void aliasesWithBackticks(QueryStatement queryStatement) {
String sql = queryStatement.getSqlQuery().getSql();
sql = SqlReplaceHelper.replaceAliasWithBackticks(sql);
queryStatement.getSqlQuery().setSql(sql);
}
private AggOption getAggOption(String sql, Set<MetricSchemaResp> metricSchemas) {
if (SqlSelectFunctionHelper.hasAggregateFunction(sql)) {
return AggOption.AGGREGATION;