mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 19:51:00 +00:00
(improvement)(chat) metricSemantic query without dateInfo not get queryRatio (#380)
Co-authored-by: jipengli <jipengli@tencent.com>
This commit is contained in:
@@ -382,15 +382,17 @@ public class SemanticService {
|
|||||||
Optional<String> lastDayOp = result.getResultList().stream().filter(r -> r.containsKey(dateField))
|
Optional<String> lastDayOp = result.getResultList().stream().filter(r -> r.containsKey(dateField))
|
||||||
.map(r -> r.get(dateField).toString())
|
.map(r -> r.get(dateField).toString())
|
||||||
.sorted(Comparator.reverseOrder()).findFirst();
|
.sorted(Comparator.reverseOrder()).findFirst();
|
||||||
if (lastDayOp.isPresent()) {
|
if (!lastDayOp.isPresent()) {
|
||||||
Optional<Map<String, Object>> lastValue = result.getResultList().stream()
|
return new AggregateInfo();
|
||||||
.filter(r -> r.get(dateField).toString().equals(lastDayOp.get())).findFirst();
|
|
||||||
if (lastValue.isPresent() && lastValue.get().containsKey(ratioMetric.get().getBizName())) {
|
|
||||||
DecimalFormat df = new DecimalFormat("#.####");
|
|
||||||
metricInfo.setValue(df.format(lastValue.get().get(ratioMetric.get().getBizName())));
|
|
||||||
}
|
|
||||||
metricInfo.setDate(lastValue.get().get(dateField).toString());
|
|
||||||
}
|
}
|
||||||
|
Optional<Map<String, Object>> lastValue = result.getResultList().stream()
|
||||||
|
.filter(r -> r.get(dateField).toString().equals(lastDayOp.get())).findFirst();
|
||||||
|
if (lastValue.isPresent() && lastValue.get().containsKey(ratioMetric.get().getBizName())) {
|
||||||
|
DecimalFormat df = new DecimalFormat("#.####");
|
||||||
|
metricInfo.setValue(df.format(lastValue.get().get(ratioMetric.get().getBizName())));
|
||||||
|
}
|
||||||
|
metricInfo.setDate(lastValue.get().get(dateField).toString());
|
||||||
|
|
||||||
CompletableFuture<MetricInfo> metricInfoRoll = CompletableFuture
|
CompletableFuture<MetricInfo> metricInfoRoll = CompletableFuture
|
||||||
.supplyAsync(() -> {
|
.supplyAsync(() -> {
|
||||||
return queryRatio(user, semanticParseInfo, ratioMetric.get(), AggOperatorEnum.RATIO_ROLL,
|
return queryRatio(user, semanticParseInfo, ratioMetric.get(), AggOperatorEnum.RATIO_ROLL,
|
||||||
|
|||||||
Reference in New Issue
Block a user