mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-30 04:54:25 +08:00
Compare commits
1 Commits
d4331369af
...
9ee1389562
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ee1389562 |
@@ -73,31 +73,15 @@ public class SqlGenerateUtils {
|
||||
public String getSelect(StructQuery structQuery) {
|
||||
String aggStr = structQuery.getAggregators().stream().map(this::getSelectField)
|
||||
.collect(Collectors.joining(","));
|
||||
String result = String.join(",", structQuery.getGroups());
|
||||
if (StringUtils.isNotBlank(aggStr)) {
|
||||
if (!CollectionUtils.isEmpty(structQuery.getGroups())) {
|
||||
result = String.join(",", structQuery.getGroups()) + "," + aggStr;
|
||||
} else {
|
||||
result = aggStr;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return CollectionUtils.isEmpty(structQuery.getGroups()) ? aggStr
|
||||
: String.join(",", structQuery.getGroups()) + "," + aggStr;
|
||||
}
|
||||
|
||||
public String getSelect(StructQuery structQuery, Map<String, String> deriveMetrics) {
|
||||
String aggStr = structQuery.getAggregators().stream()
|
||||
.map(a -> getSelectField(a, deriveMetrics)).collect(Collectors.joining(","));
|
||||
String result = String.join(",", structQuery.getGroups());
|
||||
if (StringUtils.isNotBlank(aggStr)) {
|
||||
if (!CollectionUtils.isEmpty(structQuery.getGroups())) {
|
||||
result = String.join(",", structQuery.getGroups()) + "," + aggStr;
|
||||
} else {
|
||||
result = aggStr;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return CollectionUtils.isEmpty(structQuery.getGroups()) ? aggStr
|
||||
: String.join(",", structQuery.getGroups()) + "," + aggStr;
|
||||
}
|
||||
|
||||
public String getSelectField(final Aggregator agg) {
|
||||
@@ -156,10 +140,7 @@ public class SqlGenerateUtils {
|
||||
public String generateWhere(StructQuery structQuery, ItemDateResp itemDateResp) {
|
||||
String whereClauseFromFilter =
|
||||
sqlFilterUtils.getWhereClause(structQuery.getDimensionFilters());
|
||||
String whereFromDate = "";
|
||||
if (structQuery.getDateInfo() != null) {
|
||||
whereFromDate = getDateWhereClause(structQuery.getDateInfo(), itemDateResp);
|
||||
}
|
||||
String whereFromDate = getDateWhereClause(structQuery.getDateInfo(), itemDateResp);
|
||||
String mergedWhere =
|
||||
mergeDateWhereClause(structQuery, whereClauseFromFilter, whereFromDate);
|
||||
if (StringUtils.isNotBlank(mergedWhere)) {
|
||||
|
||||
Reference in New Issue
Block a user