Skip to content

Commit

Permalink
improve the method name def
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Dec 29, 2023
1 parent d87f1a3 commit 7261769
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public static List<RelationMapping> generate(List<CatalogRelation> sources, List
Set<Long> sourceTableKeySet = sourceTableRelationIdMap.keySet();
List<List<BiMap<MappedRelation, MappedRelation>>> mappedRelations = new ArrayList<>();

for (Long sourceTableQualifier : sourceTableKeySet) {
Set<MappedRelation> sourceMappedRelations = sourceTableRelationIdMap.get(sourceTableQualifier);
Set<MappedRelation> targetMappedRelations = targetTableRelationIdMap.get(sourceTableQualifier);
for (Long sourceTableId : sourceTableKeySet) {
Set<MappedRelation> sourceMappedRelations = sourceTableRelationIdMap.get(sourceTableId);
Set<MappedRelation> targetMappedRelations = targetTableRelationIdMap.get(sourceTableId);
if (targetMappedRelations.isEmpty()) {
continue;
}
Expand All @@ -89,12 +89,13 @@ public static List<RelationMapping> generate(List<CatalogRelation> sources, List
continue;
}
// relation appear more than once, should cartesian them and power set to correct combination
// if query is a0, a1, view is b0, b1
// if query is select * from tableA0, tableA1, materialized view is select * from tableA2, tableA3,
// tableA is the same table used by both query and materialized view
// relationMapping will be
// a0 b0
// a0 b1
// a1 b0
// a1 b1
// tableA0 tableA2
// tableA0 tableA3
// tableA1 tableA2
// tableA1 tableA3
ImmutableList<Pair<MappedRelation, MappedRelation>> relationMapping = Sets.cartesianProduct(
sourceMappedRelations, targetMappedRelations)
.stream()
Expand All @@ -103,8 +104,8 @@ public static List<RelationMapping> generate(List<CatalogRelation> sources, List

// the mapping in relationMappingPowerList should be bi-direction
// [
// {a0-b0, a1-b1}
// {a1-b0, a0-b1}
// {tableA0 tableA2, tableA1 tableA3}
// {tableA0 tableA3, tableA1 tableA2}
// ]
List<BiMap<MappedRelation, MappedRelation>> relationMappingPowerList = new ArrayList<>();
int relationMappingSize = relationMapping.size();
Expand Down

0 comments on commit 7261769

Please sign in to comment.