Skip to content

Commit

Permalink
Merge pull request #33376 from strongduanmu/dev-1023
Browse files Browse the repository at this point in the history
Minor refactor for JoinTableSegmentBinder
  • Loading branch information
iamhucong authored Oct 23, 2024
2 parents b6b0054 + 4d048e1 commit 345c1c0
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ private static Map<String, ProjectionSegment> getUsingColumnsByNaturalJoin(final
}

private static Map<String, ProjectionSegment> getUsingColumns(final Collection<ProjectionSegment> projectionSegments, final Collection<ColumnSegment> usingColumns, final String joinType) {
Multimap<String, ProjectionSegment> columnLabelProjectionSegments = LinkedHashMultimap.create();
projectionSegments.forEach(each -> columnLabelProjectionSegments.put(each.getColumnLabel(), each));
Multimap<CaseInsensitiveString, ProjectionSegment> columnLabelProjectionSegments = LinkedHashMultimap.create();
projectionSegments.forEach(each -> columnLabelProjectionSegments.put(new CaseInsensitiveString(each.getColumnLabel()), each));
Map<String, ProjectionSegment> result = new CaseInsensitiveMap<>();
for (ColumnSegment each : usingColumns) {
LinkedList<ProjectionSegment> groupProjectionSegments = new LinkedList<>(columnLabelProjectionSegments.get(each.getIdentifier().getValue()));
LinkedList<ProjectionSegment> groupProjectionSegments = new LinkedList<>(columnLabelProjectionSegments.get(new CaseInsensitiveString(each.getIdentifier().getValue())));
if (!groupProjectionSegments.isEmpty()) {
ProjectionSegment targetProjectionSegment =
JoinType.RIGHT.name().equalsIgnoreCase(joinType) ? groupProjectionSegments.descendingIterator().next() : groupProjectionSegments.iterator().next();
Expand Down

0 comments on commit 345c1c0

Please sign in to comment.