DefaultHBaseSerde implements HBaseSerde { @Override public Delete convertToDelete(Row row) { Delete delete = new Delete(buildRowKey(row)); for (Map.Entry<String, ColumnDef> column : columns.entrySet()) { if (!column.getValue().cf.equals("rowkey")) { delete.addColumn(Bytes.toBytes(column.getValue().cf), Bytes.toBytes(column.getValue().name)); } } return delete; }  void configure(Config config); @Override Query convertToQuery(Row row); @Override Row convertFromResult(Result result); @Override List<Row> convertFromResults(Iterable<Result> results); @Override Put convertToPut(Row row); @Override List<Put> convertToPuts(List<Row> rows); @Override Delete convertToDelete(Row row); @Override List<Delete> convertToDeletes(List<Row> rows);  }
@Test public void testConvertToDelete() { byte[] rowKey = Bytes.add(Bytes.toBytes("GOOG:"), Bytes.toBytes(1000L)); byte[] cf = Bytes.toBytes("cf1"); byte[] clordid = Bytes.toBytes("clordid"); byte[] orderqty = Bytes.toBytes("orderqty"); byte[] leavesqty = Bytes.toBytes("leavesqty"); byte[] cumqty = Bytes.toBytes("cumqty"); Row row = new RowWithSchema(fullSchema, "GOOG", 1000L, "abcd", 100, 10, 5); Delete delete = serde.convertToDelete(row); Map<byte[], List<Cell>> contents = delete.getFamilyCellMap(); assertArrayEquals("Row key should be GOOG:1000L", rowKey, delete.getRow()); assertTrue("Delete contains cf1", contents.containsKey(cf)); List<Cell> cells = contents.get(cf); assertEquals("Delete should have four cells", 4, cells.size()); assertArrayEquals("Cell 0 should be cf1:clordid", clordid, CellUtil.cloneQualifier(cells.get(0))); assertArrayEquals("Cell 1 should be cf1:cumqty", cumqty, CellUtil.cloneQualifier(cells.get(1))); assertArrayEquals("Cell 2 should be cf1:leavesqty", leavesqty, CellUtil.cloneQualifier(cells.get(2))); assertArrayEquals("Cell 3 should be cf1:orderqty", orderqty, CellUtil.cloneQualifier(cells.get(3))); }