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



##########
File path: 
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/IgniteTableImpl.java
##########
@@ -303,46 +304,75 @@ public void removeIndex(String idxName) {
     }
 
     private <RowT> BinaryRow updateTuple(RowT row, List<String> updateColList, 
ExecutionContext<RowT> ectx) {
-        int nonNullVarlenKeyCols = 0;
-        int nonNullVarlenValCols = 0;
-
         RowHandler<RowT> hnd = ectx.rowHandler();
-        int offset = desc.columnsCount();
-        Set<String> toUpdate = new HashSet<>(updateColList);
 
-        for (ColumnDescriptor colDesc : columnsOrderedByPhysSchema) {
-            if (colDesc.physicalType().spec().fixedLength()) {
-                continue;
-            }
+        Object2IntMap<String> columnToIndex = new 
Object2IntOpenHashMap<>(updateColList.size());
 
-            Object val = toUpdate.contains(colDesc.name())
-                    ? hnd.get(colDesc.logicalIndex() + offset, row)
-                    : hnd.get(colDesc.logicalIndex(), row);
+        for (int i = 0; i < updateColList.size(); i++) {
+            columnToIndex.put(updateColList.get(i), i + desc.columnsCount());
+        }
 
-            if (val != null) {
-                if (colDesc.key()) {
-                    nonNullVarlenKeyCols++;
-                } else {
-                    nonNullVarlenValCols++;
-                }
-            }
+        int nonNullVarlenKeyCols;
+        int nonNullVarlenValCols;
+
+        int keyOffset = schemaDescriptor.keyColumns().firstVarlengthColumn();
+
+        if (keyOffset == -1) {
+            nonNullVarlenKeyCols = 0;
+        } else {
+            nonNullVarlenKeyCols = countNotNullColumns(
+                    keyOffset,
+                    schemaDescriptor.keyColumns().length(),
+                    columnToIndex, hnd, row);
+        }
+
+        int valOffset = schemaDescriptor.valueColumns().firstVarlengthColumn();
+
+        if (valOffset == -1) {
+            nonNullVarlenValCols = 0;
+        } else {

Review comment:
       ```suggestion
           if (valOffset > -1) {
   ```




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