2 Commits

Author SHA1 Message Date
mislayming
9ee1389562 Merge aaf2d46a56 into 75f623404d 2025-02-21 20:15:30 +08:00
jerryjzhang
75f623404d (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
2025-02-21 20:04:12 +08:00

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) {