public static Comparator<UTF8Row> dimBytesComparator() {
        return (r1, r2) -> {
            if ((r1 == null || r2 == null)
                    || (r1.rowDataAddr == 0 || r2.rowDataAddr == 0)) {
                throw new IllegalStateException("illegal row compare");
            }
            assert r1.creator.dimCount == r2.creator.dimCount;

            int len = Math.min(r1.dimDataSize, r2.dimDataSize);
            if (len == 0) {
                return Long.compare(r1.code, r2.code);
            }

            int dimCount = r1.creator.dimCount;
            long rowDataAddr1 = r1.rowDataAddr;
            long rowDataAddr2 = r2.rowDataAddr;

            int res;
            long word1, word2;
            for (int i = 0; i < dimCount; i++) {
                word1 = MemoryUtil.getLong(rowDataAddr1 + (i << 3));
                word2 = MemoryUtil.getLong(rowDataAddr2 + (i << 3));
                if (r1.creator.indexTypes[i].dataType == ColumnType.STRING) {
                    int offset1 = (int) (word1 >>> 32);
                    int len1 = (int) word1 & ColumnType.MAX_STRING_UTF8_SIZE_MASK;

                    int offset2 = (int) (word2 >>> 32);
                    int len2 = (int) word2 & ColumnType.MAX_STRING_UTF8_SIZE_MASK;

                    res = BytesUtil.compareBytes(rowDataAddr1 + offset1, len1, rowDataAddr2 + offset2, len2);
                } else {
                    res = Long.compare(word1, word2);
                }
                if (res != 0) {
                    return res;
                }
            }

            // If we don't do grouping we should never let it return zero.
            return Long.compare(r1.code, r2.code);
        };
    }
The aproximately memeory usage of this object. Currently only return the raw row data size.
indexr-segment/src/main/java/io/indexr/segment/rt/UTF8Row.java