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


##########
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:
   Are `rowReader.accessor()` and `keyReader.accessor()` worth extracting into 
variables? Current lines of code are rather long



##########
modules/binary-tuple/src/main/java/org/apache/ignite/internal/binarytuple/BinaryTuplePrinter.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.internal.binarytuple;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+import org.apache.ignite.internal.type.DecimalNativeType;
+import org.apache.ignite.internal.type.NativeType;
+import org.apache.ignite.internal.type.StructNativeType;
+import org.apache.ignite.internal.util.StringUtils;
+
+/**
+ * Produces a human-readable string representation of a {@link BinaryTuple} 
given a {@link StructNativeType} that describes the row schema.
+ *
+ * <p>Intended for debugging and logging purposes only.
+ */
+public class BinaryTuplePrinter {

Review Comment:
   The class is unused, what is it doing here?



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