mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +00:00
[fix][headless] Solve the problem of SQL execution error when alias is Chinese (#2039)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user