ptupitsyn commented on code in PR #5068:
URL: https://github.com/apache/ignite-3/pull/5068#discussion_r1920187655


##########
modules/client/src/main/java/org/apache/ignite/internal/client/compute/ClientCompute.java:
##########
@@ -140,22 +143,42 @@ public <T, R> CompletableFuture<BroadcastExecution<R>> 
submitAsync(
             AllNodesBroadcastJobTarget allNodesBroadcastTarget = 
(AllNodesBroadcastJobTarget) target;
             Set<ClusterNode> nodes = allNodesBroadcastTarget.nodes();
 
+            //noinspection unchecked
             CompletableFuture<SubmitResult>[] futures = nodes.stream()
                     .map(node -> executeOnAnyNodeAsync(Set.of(node), 
descriptor, arg))
                     .toArray(CompletableFuture[]::new);
 
-            // Wait for all the futures but don't fail resulting future, keep 
individual futures in executions.
-            return allOf(futures).handle((unused, throwable) -> new 
BroadcastJobExecutionImpl<>(
-                    Arrays.stream(futures)
-                            .map(fut -> mapSubmitResult(descriptor, 
cancellationToken, fut))
-                            .collect(Collectors.toList())
-            ));
+            return mapSubmitFutures(futures, descriptor, cancellationToken);
+        } else if (target instanceof TableJobTarget) {
+            TableJobTarget tableJobTarget = (TableJobTarget) target;
+            String tableName = tableJobTarget.tableName();
+            return getTable(tableName)
+                    .thenCompose(table -> 
table.partitionManager().primaryReplicasAsync()
+                            .thenCompose(replicas -> {

Review Comment:
   ```suggestion
                       .thenCompose(table -> 
table.partitionManager().primaryReplicasAsync())
                       .thenCompose(replicas -> {
   ```
   
   A bit easier to comprehend, IMO.



##########
modules/compute/src/main/java/org/apache/ignite/internal/compute/IgniteComputeImpl.java:
##########
@@ -404,13 +405,38 @@ public 
CompletableFuture<JobExecution<ComputeJobDataHolder>> submitColocatedInte
             List<DeploymentUnit> units,
             String jobClassName,
             JobExecutionOptions options,
-            @Nullable CancellationToken cancellationToken,
-            @Nullable ComputeJobDataHolder arg) {
+            @Nullable ComputeJobDataHolder arg,
+            @Nullable CancellationToken cancellationToken
+    ) {
         return primaryReplicaForPartitionByTupleKey(table, key)
                 .thenApply(primaryNode -> executeOnOneNodeWithFailover(
                         primaryNode,
                         new NextColocatedWorkerSelector<>(placementDriver, 
topologyService, clock, table, key),
-                        units, jobClassName, options, cancellationToken, arg
+                        units, jobClassName, options, arg, cancellationToken
+                ));
+    }
+
+    @Override
+    public CompletableFuture<JobExecution<ComputeJobDataHolder>> 
submitPartitionedInternal(
+            TableViewInternal table,
+            int partitionId,
+            List<DeploymentUnit> units,
+            String jobClassName,
+            JobExecutionOptions jobExecutionOptions,
+            @Nullable ComputeJobDataHolder arg,
+            @Nullable CancellationToken cancellationToken
+    ) {
+        ExecutionOptions options = ExecutionOptions.builder()
+                .priority(jobExecutionOptions.priority())
+                .maxRetries(jobExecutionOptions.maxRetries())
+                .partition(new HashPartition(partitionId))
+                .build();

Review Comment:
   ```suggestion
                   .build();
   
   ```
   
   Separate multi-line statements for readability.



-- 
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]

Reply via email to