saintstack commented on a change in pull request #1062: HBASE-23705 Add
CellComparator to HFileContext
URL: https://github.com/apache/hbase/pull/1062#discussion_r368618259
##########
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:
> Only when a user tries to do getRowArray on a BB backed cell we try to
copy the row part and then do the comparsion. In that case he should also be
using getRowOfset() only which would be
I should have been more specific. Lets make it so no need to copy-to-compare
ever.
----------------------------------------------------------------
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