Copilot commented on code in PR #6242:
URL: https://github.com/apache/ignite-3/pull/6242#discussion_r2205091618


##########
modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/StreamerReceiverSerializer.cs:
##########
@@ -226,19 +268,25 @@ private static List<T> ReadReceiverPage<T>(ref 
BinaryTupleReader receiverInfo)
         return items;
     }
 
-    private static object? ReadReceiverArg(ref BinaryTupleReader reader, int 
index)
+    private static TArg? ReadReceiverArg<TArg>(ref BinaryTupleReader reader, 
int index, IMarshaller<TArg>? marshaller)
     {
         if (reader.IsNull(index))
         {
-            return null;
+            return default;

Review Comment:
   Returning `default` for a generic type parameter may not be the intended 
behavior. Consider returning `default(TArg)` explicitly or documenting that 
null is expected for reference types.
   ```suggestion
               return default(TArg);
   ```



##########
modules/platforms/dotnet/Apache.Ignite.Tests/Table/TestJsonMarshaller.cs:
##########
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Apache.Ignite.Tests.Table;
+
+using System;
+using System.Buffers;
+using System.Text;
+using Ignite.Marshalling;
+
+/// <summary>
+/// Test JSON marshaller.
+/// </summary>
+/// <typeparam name="T">Element type.</typeparam>
+public class TestJsonMarshaller<T> : IMarshaller<T>
+{
+    private readonly JsonMarshaller<T> _marshaller;
+
+    public TestJsonMarshaller(JsonMarshaller<T> marshaller) => _marshaller = 
marshaller;
+
+    public void Marshal(T obj, IBufferWriter<byte> writer) => 
_marshaller.Marshal(obj, writer);
+
+    public T Unmarshal(ReadOnlySpan<byte> bytes)
+    {
+        T res;
+
+        try
+        {
+            res = _marshaller.Unmarshal(bytes);
+        }
+        catch (Exception e)
+        {
+            throw new InvalidOperationException($"Failed to deserialize JSON: 
'{Encoding.UTF8.GetString(bytes)}'", e);
+        }
+
+        if (res != null && res.ToString()!.Contains("error", 
StringComparison.OrdinalIgnoreCase))

Review Comment:
   Using string comparison on ToString() output for error detection is fragile 
and could produce false positives. Consider a more robust error simulation 
mechanism.



##########
modules/platforms/dotnet/Apache.Ignite/Internal/Table/RecordView.cs:
##########
@@ -415,6 +418,9 @@ await DataStreamerWithReceiver.StreamDataAsync<TSource, T, 
TPayload, TArg, objec
                 receiver.DeploymentUnits ?? [],
                 receiver.ReceiverClassName,
                 receiver.Options ?? ReceiverExecutionOptions.Default,
+                null,
+                null,
+                null,

Review Comment:
   [nitpick] These hardcoded null values for marshallers should be replaced 
with named parameters or constants to improve code clarity and maintainability.
   ```suggestion
                   DefaultMarshaller,
                   DefaultMarshaller,
                   DefaultMarshaller,
   ```



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