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

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


The following commit(s) were added to refs/heads/main by this push:
     new b677df4eb95 IGNITE-25360 .NET: Fix streamer exception on empty key 
(#5883)
b677df4eb95 is described below

commit b677df4eb9518c6b9d2ca5d7caa30b282fbdbccf
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Thu May 22 17:43:21 2025 +0300

    IGNITE-25360 .NET: Fix streamer exception on empty key (#5883)
---
 .../dotnet/Apache.Ignite.Tests/Compute/ComputeTests.cs    |  4 +---
 .../dotnet/Apache.Ignite.Tests/Table/DataStreamerTests.cs | 15 +++++++++++++++
 .../Apache.Ignite.Tests/Table/RecordViewBinaryTests.cs    |  2 +-
 .../Apache.Ignite.Tests/Table/SchemaValidationTest.cs     |  6 +++---
 .../Table/Serialization/TupleSerializerHandler.cs         |  5 +++++
 5 files changed, 25 insertions(+), 7 deletions(-)

diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Compute/ComputeTests.cs 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Compute/ComputeTests.cs
index 7c6a97d1755..42f003ae231 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/Compute/ComputeTests.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/Compute/ComputeTests.cs
@@ -340,9 +340,7 @@ namespace Apache.Ignite.Tests.Compute
             var ex = Assert.ThrowsAsync<ArgumentException>(async () =>
                 await 
Client.Compute.SubmitAsync(JobTarget.Colocated(TableName, new IgniteTuple { 
["VAL"] = "1" }), EchoJob, null));
 
-            Assert.AreEqual(
-                "Can't map 'IgniteTuple { VAL = 1 }' to columns 'Int64 KEY, 
String VAL'. Matching fields not found.",
-                ex!.Message);
+            Assert.AreEqual("Key column 'KEY' not found in the provided tuple 
'IgniteTuple { VAL = 1 }'", ex!.Message);
         }
 
         [Test]
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Table/DataStreamerTests.cs 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/DataStreamerTests.cs
index a256558e498..6efa0367f95 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/Table/DataStreamerTests.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/DataStreamerTests.cs
@@ -712,6 +712,21 @@ public class DataStreamerTests : IgniteTestsBase
         Assert.AreEqual(keySelector ? "key" : "payload", ex.Message);
     }
 
+    [Test]
+    public void TestReceiverEmptyKey()
+    {
+        var ex = Assert.ThrowsAsync<DataStreamerException>(async () =>
+            await TupleView.StreamDataAsync(
+            data: Enumerable.Range(0, 1).ToAsyncEnumerable(),
+            keySelector: _ => new IgniteTuple(),
+            payloadSelector: id => id,
+            receiver: TestReceiverNoResults,
+            receiverArg: "foo"));
+
+        Assert.IsInstanceOf<ArgumentException>(ex.InnerException);
+        Assert.AreEqual("Key column 'KEY' not found in the provided tuple 
'IgniteTuple { }'", ex.InnerException!.Message);
+    }
+
     [Test]
     public async Task TestWithReceiverAllDataTypes()
     {
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Table/RecordViewBinaryTests.cs 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/RecordViewBinaryTests.cs
index ca386ad802f..d9b39d2f3ad 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Table/RecordViewBinaryTests.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/RecordViewBinaryTests.cs
@@ -78,7 +78,7 @@ namespace Apache.Ignite.Tests.Table
         public void TestUpsertEmptyTupleThrowsException()
         {
             var ex = Assert.ThrowsAsync<ArgumentException>(async () => await 
TupleView.UpsertAsync(null, new IgniteTuple()));
-            StringAssert.Contains("Matching fields not found.", ex!.Message);
+            StringAssert.Contains("Key column 'KEY' not found in the provided 
tuple", ex!.Message);
         }
 
         [Test]
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Table/SchemaValidationTest.cs 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/SchemaValidationTest.cs
index 41d0d03be93..fdc13f9785a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/Table/SchemaValidationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/SchemaValidationTest.cs
@@ -107,8 +107,8 @@ public class SchemaValidationTest : IgniteTestsBase
             [ValCol] = "v"
         };
 
-        var ex = Assert.ThrowsAsync<MarshallerException>(async () => await 
TupleView.UpsertAsync(null, igniteTuple));
-        Assert.AreEqual("Missed key column: KEY", ex!.Message);
+        var ex = Assert.ThrowsAsync<ArgumentException>(async () => await 
TupleView.UpsertAsync(null, igniteTuple));
+        Assert.AreEqual("Key column 'KEY' not found in the provided tuple 
'IgniteTuple { VAL = v }'", ex!.Message);
     }
 
     [Test]
@@ -161,7 +161,7 @@ public class SchemaValidationTest : IgniteTestsBase
         };
 
         var ex = Assert.ThrowsAsync<ArgumentException>(async () => await 
TupleView.UpsertAsync(null, igniteTuple));
-        Assert.AreEqual("Can't map 'IgniteTuple { ABC = v }' to columns 'Int64 
KEY, String VAL'. Matching fields not found.", ex!.Message);
+        Assert.AreEqual("Key column 'KEY' not found in the provided tuple 
'IgniteTuple { ABC = v }'", ex!.Message);
     }
 
     [Test]
diff --git 
a/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/TupleSerializerHandler.cs
 
b/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/TupleSerializerHandler.cs
index 1e8dfdadebb..130e02583b1 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/TupleSerializerHandler.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/TupleSerializerHandler.cs
@@ -105,6 +105,11 @@ namespace Apache.Ignite.Internal.Table.Serialization
                 }
                 else
                 {
+                    if (col.IsKey)
+                    {
+                        throw new ArgumentException($"Key column '{col.Name}' 
not found in the provided tuple '{record}'");
+                    }
+
                     tupleBuilder.AppendNoValue(noValueSet);
                 }
             }

Reply via email to