@Test public void adaptResponse_emptyRow() { Row row = Row.create(ByteString.copyFromUtf8("key"), Collections.<RowCell>emptyList()); Result result = instance.adaptResponse(row); assertEquals(0, result.rawCells().length); }
@Override public Result adaptResponse(Row response) { if (response == null) { return new Result(); } SortedSet<Cell> hbaseCells = new TreeSet<>(KeyValue.COMPARATOR); byte[] rowKey = response.getKey().toByteArray(); for (com.google.cloud.bigtable.data.v2.models.RowCell rowCell : response.getCells()) { byte[] familyNameBytes = Bytes.toBytes(rowCell.getFamily()); byte[] columnQualifier = ByteStringer.extract(rowCell.getQualifier()); long hbaseTimestamp = TimestampConverter.bigtable2hbase(rowCell.getTimestamp()); RowCell keyValue = new RowCell( rowKey, familyNameBytes, columnQualifier, hbaseTimestamp, ByteStringer.extract(rowCell.getValue())); hbaseCells.add(keyValue); } return Result.create(hbaseCells.toArray(new Cell[hbaseCells.size()])); }
RowAdapter implements ResponseAdapter<Row, Result> { @Override public Result adaptResponse(Row response) { if (response == null) { return new Result(); } SortedSet<Cell> hbaseCells = new TreeSet<>(KeyValue.COMPARATOR); byte[] rowKey = response.getKey().toByteArray(); for (com.google.cloud.bigtable.data.v2.models.RowCell rowCell : response.getCells()) { byte[] familyNameBytes = Bytes.toBytes(rowCell.getFamily()); byte[] columnQualifier = ByteStringer.extract(rowCell.getQualifier()); long hbaseTimestamp = TimestampConverter.bigtable2hbase(rowCell.getTimestamp()); RowCell keyValue = new RowCell( rowKey, familyNameBytes, columnQualifier, hbaseTimestamp, ByteStringer.extract(rowCell.getValue())); hbaseCells.add(keyValue); } return Result.create(hbaseCells.toArray(new Cell[hbaseCells.size()])); } }
RowAdapter implements ResponseAdapter<Row, Result> { @Override public Result adaptResponse(Row response) { if (response == null) { return new Result(); } SortedSet<Cell> hbaseCells = new TreeSet<>(KeyValue.COMPARATOR); byte[] rowKey = response.getKey().toByteArray(); for (com.google.cloud.bigtable.data.v2.models.RowCell rowCell : response.getCells()) { byte[] familyNameBytes = Bytes.toBytes(rowCell.getFamily()); byte[] columnQualifier = ByteStringer.extract(rowCell.getQualifier()); long hbaseTimestamp = TimestampConverter.bigtable2hbase(rowCell.getTimestamp()); RowCell keyValue = new RowCell( rowKey, familyNameBytes, columnQualifier, hbaseTimestamp, ByteStringer.extract(rowCell.getValue())); hbaseCells.add(keyValue); } return Result.create(hbaseCells.toArray(new Cell[hbaseCells.size()])); }  }
RowAdapter implements ResponseAdapter<Row, Result> { @Override public Result adaptResponse(Row response) { if (response == null) { return new Result(); } SortedSet<Cell> hbaseCells = new TreeSet<>(KeyValue.COMPARATOR); byte[] rowKey = response.getKey().toByteArray(); for (com.google.cloud.bigtable.data.v2.models.RowCell rowCell : response.getCells()) { byte[] familyNameBytes = Bytes.toBytes(rowCell.getFamily()); byte[] columnQualifier = ByteStringer.extract(rowCell.getQualifier()); long hbaseTimestamp = TimestampConverter.bigtable2hbase(rowCell.getTimestamp()); RowCell keyValue = new RowCell( rowKey, familyNameBytes, columnQualifier, hbaseTimestamp, ByteStringer.extract(rowCell.getValue())); hbaseCells.add(keyValue); } return Result.create(hbaseCells.toArray(new Cell[hbaseCells.size()])); }  @Override Result adaptResponse(Row response); }
RowAdapter implements ResponseAdapter<Row, Result> { @Override public Result adaptResponse(Row response) { if (response == null) { return new Result(); } SortedSet<Cell> hbaseCells = new TreeSet<>(KeyValue.COMPARATOR); byte[] rowKey = response.getKey().toByteArray(); for (com.google.cloud.bigtable.data.v2.models.RowCell rowCell : response.getCells()) { byte[] familyNameBytes = Bytes.toBytes(rowCell.getFamily()); byte[] columnQualifier = ByteStringer.extract(rowCell.getQualifier()); long hbaseTimestamp = TimestampConverter.bigtable2hbase(rowCell.getTimestamp()); RowCell keyValue = new RowCell( rowKey, familyNameBytes, columnQualifier, hbaseTimestamp, ByteStringer.extract(rowCell.getValue())); hbaseCells.add(keyValue); } return Result.create(hbaseCells.toArray(new Cell[hbaseCells.size()])); }  @Override Result adaptResponse(Row response);  }