xtern commented on code in PR #1501:
URL: https://github.com/apache/ignite-3/pull/1501#discussion_r1094452623
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/metadata/ColocationGroup.java:
##########
@@ -194,30 +194,101 @@ public ColocationGroup colocate(ColocationGroup other)
throws ColocationMappingE
return new ColocationGroup(sourceIds, nodeNames, assignments);
}
+ private List<NodeWithTerm> intersect(List<NodeWithTerm> assignment0,
List<NodeWithTerm> assignment1, Predicate<String> filter, int p)
+ throws ColocationMappingException {
+ if (assignment0.size() == 1 && assignment1.size() == 1) {
+ NodeWithTerm first = assignment0.get(0);
+ NodeWithTerm second = assignment1.get(0);
+
+ if (filter.test(first.name()) &&
first.name().equals(second.name())) {
+ validateTerm(first, second, p);
+
+ return assignment0;
+ }
+
+ return Collections.emptyList();
+ } else {
+ if (assignment0.size() > assignment1.size()) {
+ List<NodeWithTerm> tmp = assignment0;
+ assignment0 = assignment1;
+ assignment1 = tmp;
+ }
+
+ List<NodeWithTerm> assignment = new ArrayList<>();
+
+ Map<String, NodeWithTerm> hashedByNameAssignment =
+
assignment1.stream().collect(Collectors.toMap(NodeWithTerm::name, nodeWithTerm
-> nodeWithTerm));
+
+ for (NodeWithTerm first : assignment0) {
+ if (!filter.test(first.name())) {
+ continue;
+ }
Review Comment:
Done, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]