AMashenkov commented on a change in pull request #245:
URL: https://github.com/apache/ignite-3/pull/245#discussion_r676918924



##########
File path: 
modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTupleBuilder.java
##########
@@ -55,62 +63,168 @@
     }
 
     /** {@inheritDoc} */
-    @Override public <T> T valueOrDefault(String colName, T def) {
-        return (T)map.getOrDefault(colName, def);
+    @Override public <T> T valueOrDefault(String columnName, T def) {
+        T res = value(columnName);
+
+        return res == null ? def : res;

Review comment:
       Seems, default value will be returned here even if user explicitly set 
column to 'null'.

##########
File path: 
modules/client/src/main/java/org/apache/ignite/internal/client/table/ClientTupleBuilder.java
##########
@@ -18,33 +18,41 @@
 package org.apache.ignite.internal.client.table;
 
 import java.util.BitSet;
-import java.util.HashMap;
+import java.util.Iterator;
 import java.util.UUID;
 
 import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.lang.IgniteException;
 import org.apache.ignite.table.Tuple;
 import org.apache.ignite.table.TupleBuilder;
+import org.jetbrains.annotations.NotNull;
 
 /**
  * Client tuple builder.
  */
 public final class ClientTupleBuilder implements TupleBuilder, Tuple {
     /** Columns values. */
-    private final HashMap<String, Object> map = new HashMap<>();
+    private final Object[] vals;
+
+    /** Schema. */
+    private final ClientSchema schema;
 
     /**
-     * Gets the underlying map.
+     * Constructor.
      *
-     * @return Underlying map
+     * @param schema Schema.
      */
-    public HashMap<String, Object> map() {
-        return map;
+    public ClientTupleBuilder(ClientSchema schema) {
+        assert schema != null;
+
+        this.schema = schema;
+        this.vals = new Object[schema.columns().length];
     }
 
     /** {@inheritDoc} */
     @Override public TupleBuilder set(String colName, Object value) {
-        map.put(colName, value);
+        var col = schema.column(colName);
+
+        vals[col.schemaIndex()] = value;

Review comment:
       At what point you think a schema version should be bumped when a user 
set value for unknown columns?
   Will a client itself force a new schema version registration in that case?

##########
File path: 
modules/client/src/test/java/org/apache/ignite/client/ClientTupleBuilderTest.java
##########
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.client;
+
+/**
+ * Tests client tuple builder implementation.
+ */
+public class ClientTupleBuilderTest {
+    // TODO

Review comment:
       TODO must refers to a ticket.




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


Reply via email to