This is an automated email from the ASF dual-hosted git repository.

ptupitsyn pushed a commit to branch ignite-27278
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/ignite-27278 by this push:
     new 13390f40201 wip
13390f40201 is described below

commit 13390f402011f374e79acb51f223271020b3bba3
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Tue Dec 23 11:28:59 2025 +0200

    wip
---
 .../dotnet/Apache.Ignite/Compute/JobTarget.cs      | 22 ++++++++++++++++++++--
 .../Apache.Ignite/Internal/Compute/Compute.cs      |  9 +++------
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/modules/platforms/dotnet/Apache.Ignite/Compute/JobTarget.cs 
b/modules/platforms/dotnet/Apache.Ignite/Compute/JobTarget.cs
index 0c635f89960..5d0e5c7093f 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Compute/JobTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Compute/JobTarget.cs
@@ -21,6 +21,7 @@ using System.Collections.Generic;
 using Internal.Common;
 using Network;
 using Table;
+using Table.Mapper;
 
 /// <summary>
 /// Compute job target.
@@ -75,7 +76,23 @@ public static class JobTarget
     {
         IgniteArgumentCheck.NotNull(key);
 
-        return new ColocatedTarget<TKey>(tableName, key);
+        return new ColocatedTarget<TKey>(tableName, key, null);
+    }
+
+    /// <summary>
+    /// Creates a colocated job target for a specific table and key.
+    /// </summary>
+    /// <param name="tableName">Table name.</param>
+    /// <param name="key">Key.</param>
+    /// <param name="mapper">Mapper for the key.</param>
+    /// <typeparam name="TKey">Key type.</typeparam>
+    /// <returns>Colocated job target.</returns>
+    public static IJobTarget<TKey> Colocated<TKey>(QualifiedName tableName, 
TKey key, IMapper<TKey> mapper)
+        where TKey : notnull
+    {
+        IgniteArgumentCheck.NotNull(key);
+
+        return new ColocatedTarget<TKey>(tableName, key, mapper);
     }
 
     /// <summary>
@@ -106,7 +123,8 @@ public static class JobTarget
     /// </summary>
     /// <param name="TableName">Table name.</param>
     /// <param name="Data">Key.</param>
+    /// <param name="Mapper">Optional mapper for the key.</param>
     /// <typeparam name="TKey">Key type.</typeparam>
-    internal sealed record ColocatedTarget<TKey>(QualifiedName TableName, TKey 
Data) : IJobTarget<TKey>
+    internal sealed record ColocatedTarget<TKey>(QualifiedName TableName, TKey 
Data, IMapper<TKey>? Mapper) : IJobTarget<TKey>
         where TKey : notnull;
 }
diff --git a/modules/platforms/dotnet/Apache.Ignite/Internal/Compute/Compute.cs 
b/modules/platforms/dotnet/Apache.Ignite/Internal/Compute/Compute.cs
index 3f195699b5e..e330f066ec7 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/Compute/Compute.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Compute/Compute.cs
@@ -79,9 +79,7 @@ namespace Apache.Ignite.Internal.Compute
             {
                 JobTarget.SingleNodeTarget singleNode => 
SubmitAsync([singleNode.Data], jobDescriptor, arg, cancellationToken),
                 JobTarget.AnyNodeTarget anyNode => SubmitAsync(anyNode.Data, 
jobDescriptor, arg, cancellationToken),
-
-                // TODO: Should mapper come from target?
-                JobTarget.ColocatedTarget<TTarget> colocated => 
SubmitColocatedAsync(colocated, jobDescriptor, arg, null, cancellationToken),
+                JobTarget.ColocatedTarget<TTarget> colocated => 
SubmitColocatedAsync(colocated, jobDescriptor, arg, cancellationToken),
 
                 _ => throw new ArgumentException("Unsupported job target: " + 
target)
             };
@@ -610,7 +608,6 @@ namespace Apache.Ignite.Internal.Compute
             JobTarget.ColocatedTarget<TKey> target,
             JobDescriptor<TArg, TResult> jobDescriptor,
             TArg arg,
-            IMapper<TKey>? mapper,
             CancellationToken cancellationToken)
             where TKey : notnull
         {
@@ -628,10 +625,10 @@ namespace Apache.Ignite.Internal.Compute
                     .ConfigureAwait(false);
             }
 
-            if (mapper != null)
+            if (target.Mapper != null)
             {
                 // TODO: Avoid allocation.
-                Func<Table, IRecordSerializerHandler<TKey>> handlerFunc = _ => 
new MapperSerializerHandler<TKey>(mapper);
+                Func<Table, IRecordSerializerHandler<TKey>> handlerFunc = _ => 
new MapperSerializerHandler<TKey>(target.Mapper);
 
                 return await ExecuteColocatedAsync<TArg, TResult, TKey>(
                         target.TableName,

Reply via email to