AMashenkov commented on code in PR #1501:
URL: https://github.com/apache/ignite-3/pull/1501#discussion_r1092987733
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/metadata/ColocationGroup.java:
##########
@@ -194,30 +186,74 @@ public ColocationGroup colocate(ColocationGroup other)
throws ColocationMappingE
return new ColocationGroup(sourceIds, nodeNames, assignments);
}
+ private List<NodeWithTerm> intersect(List<NodeWithTerm> assign0,
List<NodeWithTerm> assign1, @Nullable Set<String> filter, int partId)
+ throws ColocationMappingException {
+ List<NodeWithTerm> intersection = new ArrayList<>();
+
+ for (NodeWithTerm nodeWithTerm : assign0) {
+ if (filter != null && !filter.contains(nodeWithTerm.name())) {
+ continue;
+ }
+
+ for (NodeWithTerm otherNodeWithTerm : assign1) {
Review Comment:
This solution has O(n*m) complexity.
Maybe it make sense to convert 'assign0' to HashMap (nodeName ->
nodeWithTerm),
then validate 'assign1' items, which are in the Map and filter out others.
This will be O(n) + O(m).
--
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]