AMashenkov commented on code in PR #2342:
URL: https://github.com/apache/ignite-3/pull/2342#discussion_r1275180105


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImpl.java:
##########
@@ -952,4 +983,30 @@ public interface ImplementorFactory<RowT> {
         /** Creates the relational node implementor with the given context. */
         LogicalRelImplementor<RowT> create(ExecutionContext<RowT> ctx, 
ResolvedDependencies resolvedDependencies);
     }
+
+    static final class FetchColocationGroups {
+
+        private final ResolvedDependencies deps;
+
+        FetchColocationGroups(ResolvedDependencies deps) {
+            this.deps = deps;
+        }
+
+        CompletableFuture<Map<Integer, ColocationGroup>> execute() {
+            List<CompletableFuture<Pair<Integer, ColocationGroup>>> list = new 
ArrayList<>();
+
+            for (Integer tableId : deps.tableIds()) {
+                CompletableFuture<ColocationGroup> f = 
deps.fetchColocationGroup(tableId);
+                list.add(f.thenApply(c -> new Pair<>(tableId, c)));
+            }
+
+            CompletableFuture<Void> all = 
CompletableFuture.allOf(list.toArray(new CompletableFuture[0]));
+
+            return all.thenApply(
+                    v -> list.stream()
+                            .map(CompletableFuture::join)
+                            .collect(Collectors.toMap(Pair::getFirst, 
Pair::getSecond)));
+
+        }
+    }

Review Comment:
   Seems, this method can be static helper method and class can be dropped.
   Or maybe the whole method can be moved to `ResolvedDependencies` class.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to