/** * Marked as audience Private as of 1.2.0. * Creating a Cell with tags and a memstoreTS/mvcc is an * internal implementation detail not for public use. * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. Use * {@link ExtendedCellBuilder} instead */ @InterfaceAudience.Private @Deprecated public static Cell createCell(final byte[] row, final byte[] family, final byte[] qualifier, final long timestamp, final byte type, final byte[] value, byte[] tags, final long memstoreTS) { return ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY) .setRow(row) .setFamily(family) .setQualifier(qualifier) .setTimestamp(timestamp) .setType(type) .setValue(value) .setTags(tags) .setSequenceId(memstoreTS) .build(); }
@Override protected Cell parseCell() throws IOException { byte [] row = readByteArray(this.in); byte [] family = readByteArray(in); byte [] qualifier = readByteArray(in); byte [] longArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, longArray); long timestamp = Bytes.toLong(longArray); byte type = (byte) this.in.read(); byte[] value = readByteArray(in); // Read memstore version byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, memstoreTSArray); long memstoreTS = Bytes.toLong(memstoreTSArray); return cellBuilder.clear() .setRow(row) .setFamily(family) .setQualifier(qualifier) .setTimestamp(timestamp) .setType(type) .setValue(value) .setSequenceId(memstoreTS) .build(); }
@Override protected Cell parseCell() throws IOException { byte[] row = readByteArray(this.in); byte[] family = readByteArray(in); byte[] qualifier = readByteArray(in); byte[] longArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, longArray); long timestamp = Bytes.toLong(longArray); byte type = (byte) this.in.read(); byte[] value = readByteArray(in); byte[] tags = readByteArray(in); // Read memstore version byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, memstoreTSArray); long memstoreTS = Bytes.toLong(memstoreTSArray); return cellBuilder.clear() .setRow(row) .setFamily(family) .setQualifier(qualifier) .setTimestamp(timestamp) .setType(type) .setValue(value) .setSequenceId(memstoreTS) .setTags(tags) .build(); }
@Test public void testExtendedCellBuilderWithShallowCopy() { byte[] row = new byte[]{OLD_DATA}; byte[] family = new byte[]{OLD_DATA}; byte[] qualifier = new byte[]{OLD_DATA}; byte[] value = new byte[]{OLD_DATA}; byte[] tags = new byte[]{OLD_DATA}; long seqId = 999; Cell cell = ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY) .setRow(row) .setFamily(family) .setQualifier(qualifier) .setType(KeyValue.Type.Put.getCode()) .setValue(value) .setTags(tags) .setSequenceId(seqId) .build(); row[0] = NEW_DATA; family[0] = NEW_DATA; qualifier[0] = NEW_DATA; value[0] = NEW_DATA; tags[0] = NEW_DATA; assertEquals(NEW_DATA, cell.getRowArray()[cell.getRowOffset()]); assertEquals(NEW_DATA, cell.getFamilyArray()[cell.getFamilyOffset()]); assertEquals(NEW_DATA, cell.getQualifierArray()[cell.getQualifierOffset()]); assertEquals(NEW_DATA, cell.getValueArray()[cell.getValueOffset()]); assertEquals(NEW_DATA, cell.getTagsArray()[cell.getTagsOffset()]); assertEquals(seqId, cell.getSequenceId()); }
@Test public void testExtendedCellBuilderWithDeepCopy() { byte[] row = new byte[]{OLD_DATA}; byte[] family = new byte[]{OLD_DATA}; byte[] qualifier = new byte[]{OLD_DATA}; byte[] value = new byte[]{OLD_DATA}; byte[] tags = new byte[]{OLD_DATA}; long seqId = 999; Cell cell = ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY) .setRow(row) .setFamily(family) .setQualifier(qualifier) .setType(KeyValue.Type.Put.getCode()) .setValue(value) .setTags(tags) .setSequenceId(seqId) .build(); row[0] = NEW_DATA; family[0] = NEW_DATA; qualifier[0] = NEW_DATA; value[0] = NEW_DATA; tags[0] = NEW_DATA; assertEquals(OLD_DATA, cell.getRowArray()[cell.getRowOffset()]); assertEquals(OLD_DATA, cell.getFamilyArray()[cell.getFamilyOffset()]); assertEquals(OLD_DATA, cell.getQualifierArray()[cell.getQualifierOffset()]); assertEquals(OLD_DATA, cell.getValueArray()[cell.getValueOffset()]); assertEquals(OLD_DATA, cell.getTagsArray()[cell.getTagsOffset()]); assertEquals(seqId, cell.getSequenceId()); } }
/** * Marked as audience Private as of 1.2.0. * Creating a Cell with tags and a memstoreTS/mvcc is an * internal implementation detail not for public use. * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. Use * {@link ExtendedCellBuilder} instead */ @InterfaceAudience.Private @Deprecated public static Cell createCell(final byte[] row, final byte[] family, final byte[] qualifier, final long timestamp, final byte type, final byte[] value, byte[] tags, final long memstoreTS) { return ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY) .setRow(row) .setFamily(family) .setQualifier(qualifier) .setTimestamp(timestamp) .setType(type) .setValue(value) .setTags(tags) .setSequenceId(memstoreTS) .build(); }
/** * Marked as audience Private as of 1.2.0. * Creating a Cell with tags and a memstoreTS/mvcc is an * internal implementation detail not for public use. * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. Use * {@link ExtendedCellBuilder} instead */ @InterfaceAudience.Private @Deprecated public static Cell createCell(final byte[] row, final byte[] family, final byte[] qualifier, final long timestamp, final byte type, final byte[] value, byte[] tags, final long memstoreTS) { return ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY) .setRow(row) .setFamily(family) .setQualifier(qualifier) .setTimestamp(timestamp) .setType(type) .setValue(value) .setTags(tags) .setSequenceId(memstoreTS) .build(); }
@Override protected Cell parseCell() throws IOException { byte [] row = readByteArray(this.in); byte [] family = readByteArray(in); byte [] qualifier = readByteArray(in); byte [] longArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, longArray); long timestamp = Bytes.toLong(longArray); byte type = (byte) this.in.read(); byte[] value = readByteArray(in); // Read memstore version byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, memstoreTSArray); long memstoreTS = Bytes.toLong(memstoreTSArray); return cellBuilder.clear() .setRow(row) .setFamily(family) .setQualifier(qualifier) .setTimestamp(timestamp) .setType(type) .setValue(value) .setSequenceId(memstoreTS) .build(); }
@Override protected Cell parseCell() throws IOException { byte [] row = readByteArray(this.in); byte [] family = readByteArray(in); byte [] qualifier = readByteArray(in); byte [] longArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, longArray); long timestamp = Bytes.toLong(longArray); byte type = (byte) this.in.read(); byte[] value = readByteArray(in); // Read memstore version byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, memstoreTSArray); long memstoreTS = Bytes.toLong(memstoreTSArray); return cellBuilder.clear() .setRow(row) .setFamily(family) .setQualifier(qualifier) .setTimestamp(timestamp) .setType(type) .setValue(value) .setSequenceId(memstoreTS) .build(); }
@Override protected Cell parseCell() throws IOException { byte[] row = readByteArray(this.in); byte[] family = readByteArray(in); byte[] qualifier = readByteArray(in); byte[] longArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, longArray); long timestamp = Bytes.toLong(longArray); byte type = (byte) this.in.read(); byte[] value = readByteArray(in); byte[] tags = readByteArray(in); // Read memstore version byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, memstoreTSArray); long memstoreTS = Bytes.toLong(memstoreTSArray); return cellBuilder.clear() .setRow(row) .setFamily(family) .setQualifier(qualifier) .setTimestamp(timestamp) .setType(type) .setValue(value) .setSequenceId(memstoreTS) .setTags(tags) .build(); }
@Override protected Cell parseCell() throws IOException { byte[] row = readByteArray(this.in); byte[] family = readByteArray(in); byte[] qualifier = readByteArray(in); byte[] longArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, longArray); long timestamp = Bytes.toLong(longArray); byte type = (byte) this.in.read(); byte[] value = readByteArray(in); byte[] tags = readByteArray(in); // Read memstore version byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG]; IOUtils.readFully(this.in, memstoreTSArray); long memstoreTS = Bytes.toLong(memstoreTSArray); return cellBuilder.clear() .setRow(row) .setFamily(family) .setQualifier(qualifier) .setTimestamp(timestamp) .setType(type) .setValue(value) .setSequenceId(memstoreTS) .setTags(tags) .build(); }
@Test public void testExtendedCellBuilderWithShallowCopy() { byte[] row = new byte[]{OLD_DATA}; byte[] family = new byte[]{OLD_DATA}; byte[] qualifier = new byte[]{OLD_DATA}; byte[] value = new byte[]{OLD_DATA}; byte[] tags = new byte[]{OLD_DATA}; long seqId = 999; Cell cell = ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY) .setRow(row) .setFamily(family) .setQualifier(qualifier) .setType(KeyValue.Type.Put.getCode()) .setValue(value) .setTags(tags) .setSequenceId(seqId) .build(); row[0] = NEW_DATA; family[0] = NEW_DATA; qualifier[0] = NEW_DATA; value[0] = NEW_DATA; tags[0] = NEW_DATA; assertEquals(NEW_DATA, cell.getRowArray()[cell.getRowOffset()]); assertEquals(NEW_DATA, cell.getFamilyArray()[cell.getFamilyOffset()]); assertEquals(NEW_DATA, cell.getQualifierArray()[cell.getQualifierOffset()]); assertEquals(NEW_DATA, cell.getValueArray()[cell.getValueOffset()]); assertEquals(NEW_DATA, cell.getTagsArray()[cell.getTagsOffset()]); assertEquals(seqId, cell.getSequenceId()); }
@Test public void testExtendedCellBuilderWithDeepCopy() { byte[] row = new byte[]{OLD_DATA}; byte[] family = new byte[]{OLD_DATA}; byte[] qualifier = new byte[]{OLD_DATA}; byte[] value = new byte[]{OLD_DATA}; byte[] tags = new byte[]{OLD_DATA}; long seqId = 999; Cell cell = ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY) .setRow(row) .setFamily(family) .setQualifier(qualifier) .setType(KeyValue.Type.Put.getCode()) .setValue(value) .setTags(tags) .setSequenceId(seqId) .build(); row[0] = NEW_DATA; family[0] = NEW_DATA; qualifier[0] = NEW_DATA; value[0] = NEW_DATA; tags[0] = NEW_DATA; assertEquals(OLD_DATA, cell.getRowArray()[cell.getRowOffset()]); assertEquals(OLD_DATA, cell.getFamilyArray()[cell.getFamilyOffset()]); assertEquals(OLD_DATA, cell.getQualifierArray()[cell.getQualifierOffset()]); assertEquals(OLD_DATA, cell.getValueArray()[cell.getValueOffset()]); assertEquals(OLD_DATA, cell.getTagsArray()[cell.getTagsOffset()]); assertEquals(seqId, cell.getSequenceId()); } }
@Test public void testExtendedCellBuilderWithDeepCopy() { byte[] row = new byte[]{OLD_DATA}; byte[] family = new byte[]{OLD_DATA}; byte[] qualifier = new byte[]{OLD_DATA}; byte[] value = new byte[]{OLD_DATA}; byte[] tags = new byte[]{OLD_DATA}; long seqId = 999; Cell cell = ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY) .setRow(row) .setFamily(family) .setQualifier(qualifier) .setType(KeyValue.Type.Put.getCode()) .setValue(value) .setTags(tags) .setSequenceId(seqId) .build(); row[0] = NEW_DATA; family[0] = NEW_DATA; qualifier[0] = NEW_DATA; value[0] = NEW_DATA; tags[0] = NEW_DATA; assertEquals(OLD_DATA, cell.getRowArray()[cell.getRowOffset()]); assertEquals(OLD_DATA, cell.getFamilyArray()[cell.getFamilyOffset()]); assertEquals(OLD_DATA, cell.getQualifierArray()[cell.getQualifierOffset()]); assertEquals(OLD_DATA, cell.getValueArray()[cell.getValueOffset()]); assertEquals(OLD_DATA, cell.getTagsArray()[cell.getTagsOffset()]); assertEquals(seqId, cell.getSequenceId()); } }
@Test public void testExtendedCellBuilderWithShallowCopy() { byte[] row = new byte[]{OLD_DATA}; byte[] family = new byte[]{OLD_DATA}; byte[] qualifier = new byte[]{OLD_DATA}; byte[] value = new byte[]{OLD_DATA}; byte[] tags = new byte[]{OLD_DATA}; long seqId = 999; Cell cell = ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY) .setRow(row) .setFamily(family) .setQualifier(qualifier) .setType(KeyValue.Type.Put.getCode()) .setValue(value) .setTags(tags) .setSequenceId(seqId) .build(); row[0] = NEW_DATA; family[0] = NEW_DATA; qualifier[0] = NEW_DATA; value[0] = NEW_DATA; tags[0] = NEW_DATA; assertEquals(NEW_DATA, cell.getRowArray()[cell.getRowOffset()]); assertEquals(NEW_DATA, cell.getFamilyArray()[cell.getFamilyOffset()]); assertEquals(NEW_DATA, cell.getQualifierArray()[cell.getQualifierOffset()]); assertEquals(NEW_DATA, cell.getValueArray()[cell.getValueOffset()]); assertEquals(NEW_DATA, cell.getTagsArray()[cell.getTagsOffset()]); assertEquals(seqId, cell.getSequenceId()); }