(fix)(headless)Fix aggregator parsing of struct query.
Some checks failed
supersonic CentOS CI / build (21) (push) Has been cancelled
supersonic mac CI / build (21) (push) Has been cancelled
supersonic ubuntu CI / build (21) (push) Has been cancelled
supersonic windows CI / build (21) (push) Has been cancelled

This commit is contained in:
jerryjzhang
2025-02-21 20:04:12 +08:00
parent 94e853f57e
commit 75f623404d

View File

@@ -86,17 +86,17 @@ public class SqlGenerateUtils {
public String getSelectField(final Aggregator agg) {
if (AggOperatorEnum.COUNT_DISTINCT.equals(agg.getFunc())) {
return "count(distinct " + agg.getColumn() + " ) AS " + agg.getColumn() + " ";
return "count(distinct " + agg.getColumn() + " ) ";
}
if (CollectionUtils.isEmpty(agg.getArgs())) {
return agg.getFunc() + "( " + agg.getColumn() + " ) AS " + agg.getColumn() + " ";
return agg.getFunc() + "( " + agg.getColumn() + " ) ";
}
return agg.getFunc() + "( "
+ agg.getArgs().stream()
.map(arg -> arg.equals(agg.getColumn()) ? arg
: (StringUtils.isNumeric(arg) ? arg : ("'" + arg + "'")))
.collect(Collectors.joining(","))
+ " ) AS " + agg.getColumn() + " ";
+ " ) ";
}
public String getSelectField(final Aggregator agg, Map<String, String> deriveMetrics) {