saintstack commented on a change in pull request #1062: HBASE-23705 Add 
CellComparator to HFileContext
URL: https://github.com/apache/hbase/pull/1062#discussion_r368323917
 
 

 ##########
 File path: 
hbase-common/src/main/java/org/apache/hadoop/hbase/CellComparatorImpl.java
 ##########
 @@ -377,6 +378,27 @@ private static int compareRows(byte[] left, int loffset, 
int llength, byte[] rig
       return result;
     }
 
+    @Override
+    public int compareRows(ByteBuffer row, Cell cell) {
+      byte [] array;
+      int offset;
+      int len = row.remaining();
+      if (row.hasArray()) {
+        array = row.array();
+        offset = row.position() + row.arrayOffset();
+      } else {
+        // This is awful, we copy the row array if offheap just so we can do a 
compare.
+        // We do this elsewhere too when Cell is backed by an offheap 
ByteBuffer.
+        // Needs fixing. TODO.
 
 Review comment:
   No.
   
   Since making this comment, I see that we do this whenever the BB is offheap. 
 Let me make an issue. This issue adds a method to CellComparator that takes a 
row held in a ByteBuffer. We need more of this with methods in Comparator that 
can stride through a BB by index so we don't have to copy on heap to compare. 
The hard part is an implementation that does not insist on two compare methods 
-- one for array and another for BB.   Would be good if could have one compare 
only.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to