korlov42 commented on code in PR #7932:
URL: https://github.com/apache/ignite-3/pull/7932#discussion_r3045000532


##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/BinaryRowConverter.java:
##########
@@ -53,6 +54,77 @@ public BinaryRowConverter(BinaryTupleSchema srcSchema, 
BinaryTupleSchema dstSche
         this.dstSchema = dstSchema;
     }
 
+    @Override
+    public boolean columnsMatch(BinaryRow tableRow, BinaryTuple indexColumns) {
+        assert srcSchema.convertible();
+
+        ByteBuffer tupleBuffer = tableRow.tupleSlice();
+        BinaryTupleReader rowReader = new BinaryTupleReader(
+                srcSchema.elementCount(), tupleBuffer, 
UnsafeByteBufferAccessor::new
+        );
+        // Make sure UnsafeByteBufferAccessor is used.
+        BinaryTupleReader keyReader = new BinaryTupleReader(
+                dstSchema.elementCount(), indexColumns.byteBuffer(), 
UnsafeByteBufferAccessor::new
+        );
+
+        for (int i = 0; i < dstSchema.elementCount(); i++) {
+            rowReader.seek(dstSchema.columnIndex(i));
+            keyReader.seek(i);
+
+            int rowElementBegin = rowReader.begin();
+            int keyElementBegin = keyReader.begin();
+            int rowElementLen = rowReader.end() - rowElementBegin;
+            int keyElementLen = keyReader.end() - keyElementBegin;
+
+            if (rowElementLen != keyElementLen) {
+                return false;
+            }
+
+            int probeSize = 8; // Must be aligned with `get` method used 
within the loop.
+            while (rowElementLen >= probeSize) {
+                if (rowReader.accessor().getLong(rowElementBegin) != 
keyReader.accessor().getLong(keyElementBegin)) {

Review Comment:
   agree, extracted to local variable



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