@Override public int getQualifierLength() { return this.cell.getQualifierLength(); }
@Override public int getQualifierLength() { return cell.getQualifierLength(); }
@Override public int getQualifierLength() { return cell.getQualifierLength(); }
private int calculateHashForKey(ByteBufferExtendedCell cell) { int rowHash = ByteBufferUtils.hashCode(cell.getRowByteBuffer(), cell.getRowPosition(), cell.getRowLength()); int familyHash = ByteBufferUtils.hashCode(cell.getFamilyByteBuffer(), cell.getFamilyPosition(), cell.getFamilyLength()); int qualifierHash = ByteBufferUtils.hashCode(cell.getQualifierByteBuffer(), cell.getQualifierPosition(), cell.getQualifierLength()); int hash = 31 * rowHash + familyHash; hash = 31 * hash + qualifierHash; hash = 31 * hash + (int) cell.getTimestamp(); hash = 31 * hash + cell.getTypeByte(); return hash; } }
@Test public void testGetKeyMethods() throws Exception { KeyValue kvCell = new KeyValue(row1, fam1, qual1, 0L, Type.Put, row1, tags); ByteBuffer buf = ByteBuffer.allocateDirect(kvCell.getKeyLength()); ByteBufferUtils.copyFromArrayToBuffer(buf, kvCell.getBuffer(), kvCell.getKeyOffset(), kvCell.getKeyLength()); ByteBufferExtendedCell offheapKeyOnlyKV = new ByteBufferKeyOnlyKeyValue(buf, 0, buf.capacity()); assertEquals( ROW1, ByteBufferUtils.toStringBinary(offheapKeyOnlyKV.getRowByteBuffer(), offheapKeyOnlyKV.getRowPosition(), offheapKeyOnlyKV.getRowLength())); assertEquals( FAM1, ByteBufferUtils.toStringBinary(offheapKeyOnlyKV.getFamilyByteBuffer(), offheapKeyOnlyKV.getFamilyPosition(), offheapKeyOnlyKV.getFamilyLength())); assertEquals( QUAL1, ByteBufferUtils.toStringBinary(offheapKeyOnlyKV.getQualifierByteBuffer(), offheapKeyOnlyKV.getQualifierPosition(), offheapKeyOnlyKV.getQualifierLength())); assertEquals(0L, offheapKeyOnlyKV.getTimestamp()); assertEquals(Type.Put.getCode(), offheapKeyOnlyKV.getTypeByte()); } }
QUAL1, ByteBufferUtils.toStringBinary(offheapKV.getQualifierByteBuffer(), offheapKV.getQualifierPosition(), offheapKV.getQualifierLength())); assertEquals( ROW1, QUAL1, Bytes.toStringBinary(offheapKV.getQualifierArray(), offheapKV.getQualifierOffset(), offheapKV.getQualifierLength())); assertEquals( ROW1, QUAL2, ByteBufferUtils.toStringBinary(offheapKV.getQualifierByteBuffer(), offheapKV.getQualifierPosition(), offheapKV.getQualifierLength())); byte[] nullQualifier = new byte[0]; kvCell = new KeyValue(row1, fam1, nullQualifier, 0L, Type.Put, row1); "", ByteBufferUtils.toStringBinary(offheapKV.getQualifierByteBuffer(), offheapKV.getQualifierPosition(), offheapKV.getQualifierLength())); assertEquals( ROW1,
@Override public int getQualifierLength() { return this.cell.getQualifierLength(); }
@Override public int getQualifierLength() { return this.cell.getQualifierLength(); }
@Override public int getQualifierLength() { return cell.getQualifierLength(); }
private int calculateHashForKey(ByteBufferExtendedCell cell) { int rowHash = ByteBufferUtils.hashCode(cell.getRowByteBuffer(), cell.getRowPosition(), cell.getRowLength()); int familyHash = ByteBufferUtils.hashCode(cell.getFamilyByteBuffer(), cell.getFamilyPosition(), cell.getFamilyLength()); int qualifierHash = ByteBufferUtils.hashCode(cell.getQualifierByteBuffer(), cell.getQualifierPosition(), cell.getQualifierLength()); int hash = 31 * rowHash + familyHash; hash = 31 * hash + qualifierHash; hash = 31 * hash + (int) cell.getTimestamp(); hash = 31 * hash + cell.getTypeByte(); return hash; } }
private int calculateHashForKey(ByteBufferExtendedCell cell) { int rowHash = ByteBufferUtils.hashCode(cell.getRowByteBuffer(), cell.getRowPosition(), cell.getRowLength()); int familyHash = ByteBufferUtils.hashCode(cell.getFamilyByteBuffer(), cell.getFamilyPosition(), cell.getFamilyLength()); int qualifierHash = ByteBufferUtils.hashCode(cell.getQualifierByteBuffer(), cell.getQualifierPosition(), cell.getQualifierLength()); int hash = 31 * rowHash + familyHash; hash = 31 * hash + qualifierHash; hash = 31 * hash + (int) cell.getTimestamp(); hash = 31 * hash + cell.getTypeByte(); return hash; } }
@Test public void testGetKeyMethods() throws Exception { KeyValue kvCell = new KeyValue(row1, fam1, qual1, 0L, Type.Put, row1, tags); ByteBuffer buf = ByteBuffer.allocateDirect(kvCell.getKeyLength()); ByteBufferUtils.copyFromArrayToBuffer(buf, kvCell.getBuffer(), kvCell.getKeyOffset(), kvCell.getKeyLength()); ByteBufferExtendedCell offheapKeyOnlyKV = new ByteBufferKeyOnlyKeyValue(buf, 0, buf.capacity()); assertEquals( ROW1, ByteBufferUtils.toStringBinary(offheapKeyOnlyKV.getRowByteBuffer(), offheapKeyOnlyKV.getRowPosition(), offheapKeyOnlyKV.getRowLength())); assertEquals( FAM1, ByteBufferUtils.toStringBinary(offheapKeyOnlyKV.getFamilyByteBuffer(), offheapKeyOnlyKV.getFamilyPosition(), offheapKeyOnlyKV.getFamilyLength())); assertEquals( QUAL1, ByteBufferUtils.toStringBinary(offheapKeyOnlyKV.getQualifierByteBuffer(), offheapKeyOnlyKV.getQualifierPosition(), offheapKeyOnlyKV.getQualifierLength())); assertEquals(0L, offheapKeyOnlyKV.getTimestamp()); assertEquals(Type.Put.getCode(), offheapKeyOnlyKV.getTypeByte()); } }
@Test public void testGetKeyMethods() throws Exception { KeyValue kvCell = new KeyValue(row1, fam1, qual1, 0L, Type.Put, row1, tags); ByteBuffer buf = ByteBuffer.allocateDirect(kvCell.getKeyLength()); ByteBufferUtils.copyFromArrayToBuffer(buf, kvCell.getBuffer(), kvCell.getKeyOffset(), kvCell.getKeyLength()); ByteBufferExtendedCell offheapKeyOnlyKV = new ByteBufferKeyOnlyKeyValue(buf, 0, buf.capacity()); assertEquals( ROW1, ByteBufferUtils.toStringBinary(offheapKeyOnlyKV.getRowByteBuffer(), offheapKeyOnlyKV.getRowPosition(), offheapKeyOnlyKV.getRowLength())); assertEquals( FAM1, ByteBufferUtils.toStringBinary(offheapKeyOnlyKV.getFamilyByteBuffer(), offheapKeyOnlyKV.getFamilyPosition(), offheapKeyOnlyKV.getFamilyLength())); assertEquals( QUAL1, ByteBufferUtils.toStringBinary(offheapKeyOnlyKV.getQualifierByteBuffer(), offheapKeyOnlyKV.getQualifierPosition(), offheapKeyOnlyKV.getQualifierLength())); assertEquals(0L, offheapKeyOnlyKV.getTimestamp()); assertEquals(Type.Put.getCode(), offheapKeyOnlyKV.getTypeByte()); } }
QUAL1, ByteBufferUtils.toStringBinary(offheapKV.getQualifierByteBuffer(), offheapKV.getQualifierPosition(), offheapKV.getQualifierLength())); assertEquals( ROW1, QUAL1, Bytes.toStringBinary(offheapKV.getQualifierArray(), offheapKV.getQualifierOffset(), offheapKV.getQualifierLength())); assertEquals( ROW1, QUAL2, ByteBufferUtils.toStringBinary(offheapKV.getQualifierByteBuffer(), offheapKV.getQualifierPosition(), offheapKV.getQualifierLength())); byte[] nullQualifier = new byte[0]; kvCell = new KeyValue(row1, fam1, nullQualifier, 0L, Type.Put, row1); "", ByteBufferUtils.toStringBinary(offheapKV.getQualifierByteBuffer(), offheapKV.getQualifierPosition(), offheapKV.getQualifierLength())); assertEquals( ROW1,
QUAL1, ByteBufferUtils.toStringBinary(offheapKV.getQualifierByteBuffer(), offheapKV.getQualifierPosition(), offheapKV.getQualifierLength())); assertEquals( ROW1, QUAL1, Bytes.toStringBinary(offheapKV.getQualifierArray(), offheapKV.getQualifierOffset(), offheapKV.getQualifierLength())); assertEquals( ROW1, QUAL2, ByteBufferUtils.toStringBinary(offheapKV.getQualifierByteBuffer(), offheapKV.getQualifierPosition(), offheapKV.getQualifierLength())); byte[] nullQualifier = new byte[0]; kvCell = new KeyValue(row1, fam1, nullQualifier, 0L, Type.Put, row1); "", ByteBufferUtils.toStringBinary(offheapKV.getQualifierByteBuffer(), offheapKV.getQualifierPosition(), offheapKV.getQualifierLength())); assertEquals( ROW1,