@Override public int skip(PositionedByteRange src) { CellProtos.Cell.Builder builder = CellProtos.Cell.newBuilder(); CodedInputStream is = inputStreamFromByteRange(src); is.setSizeLimit(src.getLength()); try { builder.mergeFrom(is); int consumed = is.getTotalBytesRead(); src.setPosition(src.getPosition() + consumed); return consumed; } catch (IOException e) { throw new RuntimeException("Error while skipping type.", e); } }
result = result && (hasRow() == other.hasRow()); if (hasRow()) { result = result && getRow() .equals(other.getRow()); result = result && (hasFamily() == other.hasFamily()); if (hasFamily()) { result = result && getFamily() .equals(other.getFamily()); result = result && (hasQualifier() == other.hasQualifier()); if (hasQualifier()) { result = result && getQualifier() .equals(other.getQualifier()); result = result && (hasTimestamp() == other.hasTimestamp()); if (hasTimestamp()) { result = result && (getTimestamp() == other.getTimestamp()); result = result && (hasCellType() == other.hasCellType()); if (hasCellType()) { result = result && (getCellType() == other.getCellType()); result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue());
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, row_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, family_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, qualifier_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeUInt64(4, timestamp_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeEnum(5, cellType_.getNumber()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, value_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, tags_); } getUnknownFields().writeTo(output); }
result = result && (hasRow() == other.hasRow()); if (hasRow()) { result = result && getRow() .equals(other.getRow()); result = result && (hasFamily() == other.hasFamily()); if (hasFamily()) { result = result && getFamily() .equals(other.getFamily()); result = result && (hasQualifier() == other.hasQualifier()); if (hasQualifier()) { result = result && getQualifier() .equals(other.getQualifier()); result = result && (hasTimestamp() == other.hasTimestamp()); if (hasTimestamp()) { result = result && (getTimestamp() == other.getTimestamp()); result = result && (hasCellType() == other.hasCellType()); if (hasCellType()) { result = result && (getCellType() == other.getCellType()); result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue());
result = result && (hasRow() == other.hasRow()); if (hasRow()) { result = result && getRow() .equals(other.getRow()); result = result && (hasFamily() == other.hasFamily()); if (hasFamily()) { result = result && getFamily() .equals(other.getFamily()); result = result && (hasQualifier() == other.hasQualifier()); if (hasQualifier()) { result = result && getQualifier() .equals(other.getQualifier()); result = result && (hasTimestamp() == other.hasTimestamp()); if (hasTimestamp()) { result = result && (getTimestamp() == other.getTimestamp()); result = result && (hasCellType() == other.hasCellType()); if (hasCellType()) { result = result && (getCellType() == other.getCellType()); result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue());
result = result && (hasRow() == other.hasRow()); if (hasRow()) { result = result && getRow() .equals(other.getRow()); result = result && (hasFamily() == other.hasFamily()); if (hasFamily()) { result = result && getFamily() .equals(other.getFamily()); result = result && (hasQualifier() == other.hasQualifier()); if (hasQualifier()) { result = result && getQualifier() .equals(other.getQualifier()); result = result && (hasTimestamp() == other.hasTimestamp()); if (hasTimestamp()) { result = result && (getTimestamp() == other.getTimestamp()); result = result && (hasCellType() == other.hasCellType()); if (hasCellType()) { result = result && (getCellType() == other.getCellType()); result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue());
public org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell buildPartial() { org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell result = new org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0;
public org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell buildPartial() { org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell result = new org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0;
hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasRow()) { hash = (37 * hash) + ROW_FIELD_NUMBER; hash = (53 * hash) + getRow().hashCode(); if (hasFamily()) { hash = (37 * hash) + FAMILY_FIELD_NUMBER; hash = (53 * hash) + getFamily().hashCode(); if (hasQualifier()) { hash = (37 * hash) + QUALIFIER_FIELD_NUMBER; hash = (53 * hash) + getQualifier().hashCode(); if (hasTimestamp()) { hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; hash = (53 * hash) + hashLong(getTimestamp()); if (hasCellType()) { hash = (37 * hash) + CELL_TYPE_FIELD_NUMBER; hash = (53 * hash) + hashEnum(getCellType()); if (hasValue()) { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); if (hasTags()) { hash = (37 * hash) + TAGS_FIELD_NUMBER; hash = (53 * hash) + getTags().hashCode();
public org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell buildPartial() { org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell result = new org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0;
hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasRow()) { hash = (37 * hash) + ROW_FIELD_NUMBER; hash = (53 * hash) + getRow().hashCode(); if (hasFamily()) { hash = (37 * hash) + FAMILY_FIELD_NUMBER; hash = (53 * hash) + getFamily().hashCode(); if (hasQualifier()) { hash = (37 * hash) + QUALIFIER_FIELD_NUMBER; hash = (53 * hash) + getQualifier().hashCode(); if (hasTimestamp()) { hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; hash = (53 * hash) + hashLong(getTimestamp()); if (hasCellType()) { hash = (37 * hash) + CELL_TYPE_FIELD_NUMBER; hash = (53 * hash) + hashEnum(getCellType()); if (hasValue()) { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); if (hasTags()) { hash = (37 * hash) + TAGS_FIELD_NUMBER; hash = (53 * hash) + getTags().hashCode();
hash = (19 * hash) + getDescriptorForType().hashCode(); if (hasRow()) { hash = (37 * hash) + ROW_FIELD_NUMBER; hash = (53 * hash) + getRow().hashCode(); if (hasFamily()) { hash = (37 * hash) + FAMILY_FIELD_NUMBER; hash = (53 * hash) + getFamily().hashCode(); if (hasQualifier()) { hash = (37 * hash) + QUALIFIER_FIELD_NUMBER; hash = (53 * hash) + getQualifier().hashCode(); if (hasTimestamp()) { hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; hash = (53 * hash) + hashLong(getTimestamp()); if (hasCellType()) { hash = (37 * hash) + CELL_TYPE_FIELD_NUMBER; hash = (53 * hash) + hashEnum(getCellType()); if (hasValue()) { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); if (hasTags()) { hash = (37 * hash) + TAGS_FIELD_NUMBER; hash = (53 * hash) + getTags().hashCode();
public void writeTo(com.facebook.presto.hbase.$internal.com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, row_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, family_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, qualifier_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeUInt64(4, timestamp_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeEnum(5, cellType_.getNumber()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, value_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, tags_); } getUnknownFields().writeTo(output); }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, row_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, family_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, qualifier_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeUInt64(4, timestamp_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeEnum(5, cellType_.getNumber()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, value_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, tags_); } getUnknownFields().writeTo(output); }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, row_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, family_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, qualifier_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeUInt64(4, timestamp_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeEnum(5, cellType_.getNumber()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, value_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, tags_); } getUnknownFields().writeTo(output); }
public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell other) { if (other == org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell.getDefaultInstance()) return this; if (other.hasRow()) { setRow(other.getRow()); } if (other.hasFamily()) { setFamily(other.getFamily()); } if (other.hasQualifier()) { setQualifier(other.getQualifier()); } if (other.hasTimestamp()) { setTimestamp(other.getTimestamp()); } if (other.hasCellType()) { setCellType(other.getCellType()); } if (other.hasValue()) { setValue(other.getValue()); } if (other.hasTags()) { setTags(other.getTags()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
@Override public void write(Cell cell) throws IOException { checkFlushed(); CellProtos.Cell.Builder builder = CellProtos.Cell.newBuilder(); // This copies bytes from Cell to ByteString. I don't see anyway around the copy. // ByteString is final. builder.setRow(ByteStringer.wrap(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength())); builder.setFamily(ByteStringer.wrap(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength())); builder.setQualifier(ByteStringer.wrap(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength())); builder.setTimestamp(cell.getTimestamp()); builder.setCellType(CellProtos.CellType.valueOf(cell.getTypeByte())); builder.setValue(ByteStringer.wrap(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); CellProtos.Cell pbcell = builder.build(); pbcell.writeDelimitedTo(this.out); } }
public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell other) { if (other == org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell.getDefaultInstance()) return this; if (other.hasRow()) { setRow(other.getRow()); } if (other.hasFamily()) { setFamily(other.getFamily()); } if (other.hasQualifier()) { setQualifier(other.getQualifier()); } if (other.hasTimestamp()) { setTimestamp(other.getTimestamp()); } if (other.hasCellType()) { setCellType(other.getCellType()); } if (other.hasValue()) { setValue(other.getValue()); } if (other.hasTags()) { setTags(other.getTags()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell other) { if (other == org.apache.hadoop.hbase.protobuf.generated.CellProtos.Cell.getDefaultInstance()) return this; if (other.hasRow()) { setRow(other.getRow()); } if (other.hasFamily()) { setFamily(other.getFamily()); } if (other.hasQualifier()) { setQualifier(other.getQualifier()); } if (other.hasTimestamp()) { setTimestamp(other.getTimestamp()); } if (other.hasCellType()) { setCellType(other.getCellType()); } if (other.hasValue()) { setValue(other.getValue()); } if (other.hasTags()) { setTags(other.getTags()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
/** * Basic test to verify utility methods in {@link PBType} and delegation to protobuf works. */ @Test public void testRoundTrip() { final Cell cell = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("fam"), Bytes.toBytes("qual"), Bytes.toBytes("val")); CellProtos.Cell c = ProtobufUtil.toCell(cell), decoded; PositionedByteRange pbr = new SimplePositionedByteRange(c.getSerializedSize()); pbr.setPosition(0); int encodedLength = CODEC.encode(pbr, c); pbr.setPosition(0); decoded = CODEC.decode(pbr); assertEquals(encodedLength, pbr.getPosition()); assertTrue(CellUtil.equals(cell, ProtobufUtil .toCell(ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY), decoded))); } }