DefaultHBaseSerde implements HBaseSerde { @Override public List<Put> convertToPuts(List<Row> rows) { List<Put> puts = Lists.newArrayList(); for (Row row : rows) { puts.add(convertToPut(row)); } return puts; }  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 testConvertToPuts() { 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"); List<Row> rows = Lists.newArrayList( (Row)new RowWithSchema(fullSchema, "GOOG", 1000L, "abcd", 100, 10, 5), new RowWithSchema(fullSchema, "AAPL", 1000L, "efgh", 99, 9, 4) ); List<Put> puts = serde.convertToPuts(rows); assertEquals("Puts length should be 2", 2, puts.size()); assertArrayEquals("Row key should be GOOG:1000L", Bytes.add(Bytes.toBytes("GOOG:"), Bytes.toBytes(1000L)), puts.get(0).getRow()); assertTrue("cf1:clordid should be abcd", puts.get(0).has(cf, clordid, Bytes.toBytes("abcd"))); assertTrue("cf1:orderqty should be 100", puts.get(0).has(cf, orderqty, Bytes.toBytes(100))); assertTrue("cf1:leavesqty should be 5", puts.get(0).has(cf, leavesqty, Bytes.toBytes(5))); assertTrue("cf1:cumqty should be 10", puts.get(0).has(cf, cumqty, Bytes.toBytes(10))); assertArrayEquals("Row key should be AAPL:1000L", Bytes.add(Bytes.toBytes("AAPL:"), Bytes.toBytes(1000L)), puts.get(1).getRow()); assertTrue("cf1:clordid should be efgh", puts.get(1).has(cf, clordid, Bytes.toBytes("efgh"))); assertTrue("cf1:orderqty should be 99", puts.get(1).has(cf, orderqty, Bytes.toBytes(99))); assertTrue("cf1:leavesqty should be 4", puts.get(1).has(cf, leavesqty, Bytes.toBytes(4))); assertTrue("cf1:cumqty should be 9", puts.get(1).has(cf, cumqty, Bytes.toBytes(9))); }