mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 20:25:12 +00:00
Merge branch 'tencentmusic:master' into master
This commit is contained in:
@@ -343,18 +343,25 @@ public class DataModelNode extends SemanticNode {
|
|||||||
Map<String, Long> orders = new HashMap<>();
|
Map<String, Long> orders = new HashMap<>();
|
||||||
joinDataModelNames.add(baseDataModel.getName());
|
joinDataModelNames.add(baseDataModel.getName());
|
||||||
orders.put(baseDataModel.getName(), 0L);
|
orders.put(baseDataModel.getName(), 0L);
|
||||||
|
|
||||||
|
// Adjust the order of tables in the data source to facilitate subsequent joins
|
||||||
|
ArrayList<String> joinTables = new ArrayList<>();
|
||||||
for (JoinRelation joinRelation : ontology.getJoinRelations()) {
|
for (JoinRelation joinRelation : ontology.getJoinRelations()) {
|
||||||
if (joinDataModelNames.contains(joinRelation.getLeft())
|
if (joinDataModelNames.contains(joinRelation.getLeft())
|
||||||
&& joinDataModelNames.contains(joinRelation.getRight())) {
|
&& joinDataModelNames.contains(joinRelation.getRight())) {
|
||||||
orders.put(joinRelation.getLeft(), 0L);
|
joinTables.add(joinRelation.getLeft());
|
||||||
orders.put(joinRelation.getRight(), 1L);
|
joinTables.add(joinRelation.getRight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
orders.entrySet().stream().sorted(Map.Entry.comparingByValue()).forEach(d -> {
|
for (String joinTable : joinTables) {
|
||||||
joinDataModels.add(ontology.getDataModelMap().get(d.getKey()));
|
orders.put(joinTable, orders.getOrDefault(joinTable, 0L) + 1L);
|
||||||
});
|
}
|
||||||
|
orders.entrySet().stream()
|
||||||
|
.sorted((entry1, entry2) -> entry2.getValue().compareTo(entry1.getValue())) // 倒序排序
|
||||||
|
.forEach(d -> {
|
||||||
|
joinDataModels.add(ontology.getDataModelMap().get(d.getKey()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return joinDataModels;
|
return joinDataModels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -306,6 +306,16 @@ public class JoinRender extends Renderer {
|
|||||||
r.getMiddle(), tableView.getAlias() + "." + r.getRight()))
|
r.getMiddle(), tableView.getAlias() + "." + r.getRight()))
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
matchJoinRelation.setJoinType(joinRelation.getJoinType());
|
matchJoinRelation.setJoinType(joinRelation.getJoinType());
|
||||||
|
// Added join condition judgment to solve the problem of join condition order
|
||||||
|
} else if (joinRelation.getLeft()
|
||||||
|
.equalsIgnoreCase(tableView.getDataModel().getName())
|
||||||
|
&& before.containsKey(joinRelation.getRight())) {
|
||||||
|
matchJoinRelation.setJoinCondition(joinRelation.getJoinCondition().stream()
|
||||||
|
.map(r -> Triple.of(
|
||||||
|
before.get(joinRelation.getRight()) + "." + r.getRight(),
|
||||||
|
r.getMiddle(), tableView.getAlias() + "." + r.getLeft()))
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
matchJoinRelation.setJoinType(joinRelation.getJoinType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ const AgentsSection: React.FC<Props> = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Switch
|
<Switch
|
||||||
|
key={agent.id}
|
||||||
size="small"
|
size="small"
|
||||||
defaultChecked={status === 1}
|
defaultChecked={status === 1}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user