Copilot commented on code in PR #7529:
URL: https://github.com/apache/ignite-3/pull/7529#discussion_r2763202100
##########
modules/platforms/dotnet/Apache.Ignite/Internal/Table/Serialization/TupleSerializerHandler.cs:
##########
@@ -114,17 +114,22 @@ public void Write(ref BinaryTupleBuilder tupleBuilder,
IIgniteTuple record, Sche
}
}
- ValidateMappedCount(record, schema, columns.Length, written);
+ ValidateMappedCount(record, schema, columns.Length, written,
keyOnly);
}
- private static void ValidateMappedCount(IIgniteTuple record, Schema
schema, int columnCount, int written)
+ private static void ValidateMappedCount(IIgniteTuple record, Schema
schema, int columnCount, int written, bool keyOnly)
{
if (written == 0)
{
var columnStr = schema.Columns.Select(x => x.Type + " " +
x.Name).StringJoin();
throw new ArgumentException($"Can't map '{record}' to columns
'{columnStr}'. Matching fields not found.");
}
+ if (keyOnly && written == schema.KeyColumns.Length)
+ {
+ return;
+ }
Review Comment:
The early return in key-only mode (`if (keyOnly && written ==
schema.KeyColumns.Length) return;`) skips the duplicate-field detection and
also disables validation of truly unmapped/unknown tuple fields (any extra
fields are silently ignored as long as all key columns are present). This
changes behavior compared to non-key-only tuple writes and makes cases like
`DuplicateFieldTuple` pass when used with key-only APIs.
Consider preserving the duplicate-name scan regardless of `keyOnly`, and in
key-only mode only skipping the *unmapped columns* exception for fields that
exist in `schema.Columns` (i.e., ignore value columns from the schema, but
still throw if extra fields are not in the schema).
--
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]