mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-29 20:44:25 +08:00
Compare commits
1 Commits
9ee1389562
...
943ae56301
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
943ae56301 |
@@ -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() + " ) ";
|
||||
return "count(distinct " + agg.getColumn() + " ) AS " + agg.getColumn() + " ";
|
||||
}
|
||||
if (CollectionUtils.isEmpty(agg.getArgs())) {
|
||||
return agg.getFunc() + "( " + agg.getColumn() + " ) ";
|
||||
return agg.getFunc() + "( " + agg.getColumn() + " ) AS " + 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) {
|
||||
|
||||
Reference in New Issue
Block a user