mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 12:07:42 +00:00
@@ -715,14 +715,17 @@ public class MetricServiceImpl implements MetricService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fillDefaultAgg(MetricResp metricResp, ModelResp modelResp) {
|
private void fillDefaultAgg(MetricResp metricResp, ModelResp modelResp) {
|
||||||
|
metricResp.setDefaultAgg(getDefaultAgg(metricResp, modelResp));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDefaultAgg(MetricResp metricResp, ModelResp modelResp) {
|
||||||
if (modelResp == null || (Objects.nonNull(metricResp.getDefaultAgg()) && !metricResp.getDefaultAgg()
|
if (modelResp == null || (Objects.nonNull(metricResp.getDefaultAgg()) && !metricResp.getDefaultAgg()
|
||||||
.isEmpty())) {
|
.isEmpty())) {
|
||||||
return;
|
return metricResp.getDefaultAgg();
|
||||||
}
|
}
|
||||||
// FIELD define will get from expr
|
// FIELD define will get from expr
|
||||||
if (MetricDefineType.FIELD.equals(metricResp.getMetricDefineType())) {
|
if (MetricDefineType.FIELD.equals(metricResp.getMetricDefineType())) {
|
||||||
metricResp.setDefaultAgg(SqlSelectFunctionHelper.getFirstAggregateFunctions(metricResp.getExpr()));
|
return SqlSelectFunctionHelper.getFirstAggregateFunctions(metricResp.getExpr());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
// METRIC define will get from first metric
|
// METRIC define will get from first metric
|
||||||
if (MetricDefineType.METRIC.equals(metricResp.getMetricDefineType())) {
|
if (MetricDefineType.METRIC.equals(metricResp.getMetricDefineType())) {
|
||||||
@@ -731,10 +734,10 @@ public class MetricServiceImpl implements MetricService {
|
|||||||
MetricParam metricParam = metricResp.getMetricDefineByMetricParams().getMetrics().get(0);
|
MetricParam metricParam = metricResp.getMetricDefineByMetricParams().getMetrics().get(0);
|
||||||
MetricResp firstMetricResp = getMetric(modelResp.getDomainId(), metricParam.getBizName());
|
MetricResp firstMetricResp = getMetric(modelResp.getDomainId(), metricParam.getBizName());
|
||||||
if (Objects.nonNull(firstMetricResp)) {
|
if (Objects.nonNull(firstMetricResp)) {
|
||||||
fillDefaultAgg(firstMetricResp, modelResp);
|
return getDefaultAgg(firstMetricResp, modelResp);
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
// Measure define will get from first measure
|
// Measure define will get from first measure
|
||||||
List<Measure> measures = modelResp.getModelDetail().getMeasures();
|
List<Measure> measures = modelResp.getModelDetail().getMeasures();
|
||||||
@@ -742,10 +745,10 @@ public class MetricServiceImpl implements MetricService {
|
|||||||
.getMeasures().get(0);
|
.getMeasures().get(0);
|
||||||
for (Measure measure : measures) {
|
for (Measure measure : measures) {
|
||||||
if (measure.getBizName().equalsIgnoreCase(firstMeasure.getBizName())) {
|
if (measure.getBizName().equalsIgnoreCase(firstMeasure.getBizName())) {
|
||||||
metricResp.setDefaultAgg(measure.getAgg());
|
return measure.getAgg();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user