[improvement][headless]Move discovery of query models from SemanticNode to QueryParser.

This commit is contained in:
jerryjzhang
2024-12-22 17:45:32 +08:00
parent 10a510409f
commit d8b8c4e6b9
5 changed files with 91 additions and 77 deletions

View File

@@ -45,14 +45,6 @@ public class SemanticSchemaResp {
.orElse(null);
}
public List<MetricSchemaResp> getMetrics(List<String> bizNames) {
Map<String, MetricSchemaResp> metricLowerToNameMap = metrics.stream().collect(
Collectors.toMap(entry -> entry.getBizName().toLowerCase(), entry -> entry));
return bizNames.stream().map(String::toLowerCase)
.filter(entry -> metricLowerToNameMap.containsKey(entry))
.map(entry -> metricLowerToNameMap.get(entry)).collect(Collectors.toList());
}
public DimSchemaResp getDimension(String bizName) {
return dimensions.stream()
.filter(dimension -> bizName.equalsIgnoreCase(dimension.getBizName())).findFirst()
@@ -64,14 +56,6 @@ public class SemanticSchemaResp {
.orElse(null);
}
public List<DimSchemaResp> getDimensions(List<String> bizNames) {
Map<String, DimSchemaResp> dimLowerToNameMap = dimensions.stream().collect(
Collectors.toMap(entry -> entry.getBizName().toLowerCase(), entry -> entry));
return bizNames.stream().map(String::toLowerCase)
.filter(entry -> dimLowerToNameMap.containsKey(entry))
.map(entry -> dimLowerToNameMap.get(entry)).collect(Collectors.toList());
}
public Set<String> getNameFromBizNames(Set<String> bizNames) {
Set<String> names = new HashSet<>();
for (String bizName : bizNames) {