mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 03:58:14 +00:00
(fix)(headless)Fix aggregator parsing of struct query.
This commit is contained in:
@@ -86,17 +86,17 @@ public class SqlGenerateUtils {
|
|||||||
|
|
||||||
public String getSelectField(final Aggregator agg) {
|
public String getSelectField(final Aggregator agg) {
|
||||||
if (AggOperatorEnum.COUNT_DISTINCT.equals(agg.getFunc())) {
|
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())) {
|
if (CollectionUtils.isEmpty(agg.getArgs())) {
|
||||||
return agg.getFunc() + "( " + agg.getColumn() + " ) AS " + agg.getColumn() + " ";
|
return agg.getFunc() + "( " + agg.getColumn() + " ) ";
|
||||||
}
|
}
|
||||||
return agg.getFunc() + "( "
|
return agg.getFunc() + "( "
|
||||||
+ agg.getArgs().stream()
|
+ agg.getArgs().stream()
|
||||||
.map(arg -> arg.equals(agg.getColumn()) ? arg
|
.map(arg -> arg.equals(agg.getColumn()) ? arg
|
||||||
: (StringUtils.isNumeric(arg) ? arg : ("'" + arg + "'")))
|
: (StringUtils.isNumeric(arg) ? arg : ("'" + arg + "'")))
|
||||||
.collect(Collectors.joining(","))
|
.collect(Collectors.joining(","))
|
||||||
+ " ) AS " + agg.getColumn() + " ";
|
+ " ) ";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSelectField(final Aggregator agg, Map<String, String> deriveMetrics) {
|
public String getSelectField(final Aggregator agg, Map<String, String> deriveMetrics) {
|
||||||
|
|||||||
Reference in New Issue
Block a user