vldpyatkov commented on a change in pull request #118:
URL: https://github.com/apache/ignite-3/pull/118#discussion_r640356041
##########
File path:
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java
##########
@@ -71,13 +85,37 @@ public InternalTableImpl(
/** {@inheritDoc} */
@Override public @NotNull CompletableFuture<BinaryRow> get(BinaryRow
keyRow) {
- return partitionMap.get(keyRow.hash() %
partitions).<KVGetResponse>run(new GetCommand(keyRow))
- .thenApply(KVGetResponse::getValue);
+ return partitionMap.get(keyRow.hash() %
partitions).<SingleRowResponse>run(new GetCommand(keyRow))
+ .thenApply(response -> response.getValue());
}
/** {@inheritDoc} */
@Override public @NotNull CompletableFuture<Collection<BinaryRow>>
getAll(Collection<BinaryRow> keyRows) {
- return null;
+ HashMap<Integer, HashSet<BinaryRow>> setByPartition = new HashMap<>();
+
+ for (BinaryRow keyRow : keyRows) {
+ setByPartition.computeIfAbsent(keyRow.hash() % partitions,
HashSet::new)
+ .add(keyRow);
+ }
+
+ CompletableFuture<MultiRowsResponse>[] futures = new
CompletableFuture[setByPartition.size()];
+
+ int batchNum = 0;
+
+ for (Map.Entry<Integer, HashSet<BinaryRow>> partToRows :
setByPartition.entrySet()) {
+ futures[batchNum] = partitionMap.get(partToRows.getKey()).run(new
GetAllCommand(partToRows.getValue()));
+
+ batchNum++;
+ }
+
+ CompletableFuture<Collection<BinaryRow>> future =
CompletableFuture.allOf(futures)
Review comment:
Done.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]