tkalkirill commented on code in PR #1161:
URL: https://github.com/apache/ignite-3/pull/1161#discussion_r994368109


##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/hash/io/HashIndexTreeIo.java:
##########
@@ -166,23 +227,51 @@ default HashIndexRow getRow(DataPageReader 
dataPageReader, int partitionId, long
             throws IgniteInternalCheckedException {
         int off = offset(idx);
 
-        int hash = getInt(pageAddr, off + INDEX_COLUMNS_HASH_OFFSET);
+        int hash = getInt(pageAddr, off);
+        off += Integer.BYTES;
+
+        short indexColumnsSize = getShort(pageAddr, off);
+        off += Short.BYTES;
+
+        ByteBuffer indexColumnsBuffer;
+
+        long link;
 
-        long link = readPartitionless(partitionId, pageAddr, off + 
INDEX_COLUMNS_LINK_OFFSET);
+        if (indexColumnsSize < 0) {
+            indexColumnsBuffer = ByteBuffer.wrap(getBytes(pageAddr, off, 
-indexColumnsSize));
+            off += -indexColumnsSize;
 
-        ReadIndexColumnsValue indexColumnsTraversal = new 
ReadIndexColumnsValue();
+            link = NULL_LINK;
+        } else {
+            assert indexColumnsSize == indexColumnsInlineSize() : "exp=" + 
indexColumnsInlineSize() + ", act=" + indexColumnsSize;
 
-        dataPageReader.traverse(link, indexColumnsTraversal, null);
+            link = readPartitionless(partitionId, pageAddr, off += 
indexColumnsSize);
+            off += PARTITIONLESS_LINK_SIZE_BYTES;
 
-        ByteBuffer indexColumnsBuffer = 
ByteBuffer.wrap(indexColumnsTraversal.result());
+            ReadIndexColumnsValue indexColumnsTraversal = new 
ReadIndexColumnsValue();
+
+            dataPageReader.traverse(link, indexColumnsTraversal, null);
+
+            indexColumnsBuffer = 
ByteBuffer.wrap(indexColumnsTraversal.result());
+        }
 
         IndexColumns indexColumns = new IndexColumns(partitionId, link, 
indexColumnsBuffer);
 
-        long rowIdMsb = getLong(pageAddr, off + ROW_ID_MSB_OFFSET);
-        long rowIdLsb = getLong(pageAddr, off + ROW_ID_LSB_OFFSET);
+        long rowIdMsb = getLong(pageAddr, off);
+        off += Long.BYTES;
+
+        long rowIdLsb = getLong(pageAddr, off);
+        off += Long.BYTES;
 
         RowId rowId = new RowId(partitionId, rowIdMsb, rowIdLsb);
 
         return new HashIndexRow(hash, indexColumns, rowId);
     }
+
+    /**
+     * Returns the inline size for index columns in bytes.
+     */
+    default int indexColumnsInlineSize() {

Review Comment:
   Fix it



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to