AMashenkov commented on a change in pull request #513:
URL: https://github.com/apache/ignite-3/pull/513#discussion_r771393812
##########
File path:
modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTable.java
##########
@@ -291,39 +284,22 @@ public void writeKvTuple(
ClientMessagePacker out,
boolean skipHeader
) {
- // TODO: Handle missing values and null values differently
(IGNITE-16093).
- var vals = new Object[schema.columns().length];
-
- for (var i = 0; i < key.columnCount(); i++) {
- var colName = key.columnName(i);
- var col = schema.column(colName);
-
- if (!col.key()) {
- continue;
- }
-
- vals[col.schemaIndex()] = key.value(i);
- }
-
- if (val != null) {
- for (var i = 0; i < val.columnCount(); i++) {
- var colName = val.columnName(i);
- var col = schema.column(colName);
-
- if (col.key()) {
- continue;
- }
-
- vals[col.schemaIndex()] = val.value(i);
- }
- }
-
if (!skipHeader) {
out.packIgniteUuid(id);
out.packInt(schema.version());
}
- for (var v : vals) {
+ var columns = schema.columns();
+
+ for (var i = 0; i < columns.length; i++) {
+ var col = columns[i];
+
+ Object v = col.key()
+ ? key.valueOrDefault(col.name(), NO_VALUE)
Review comment:
Key columns must always be set.
Otherwise, Tuple can't be used in Map<Tuple, Tuple>, due to a key may have
different representation.
Assume, you call KvView.getAll() and them try to find a key in the map.
KvView.getAll() will return key-tuples with all the columns (with default
values), but the user key-tuple may miss some columns.
--
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]