@Override public boolean next(ImmutableBytesWritable key, ResultWritable value) throws IOException { return rr.next(key, value.getResult()); }
/** * Deserialize a row from the HBase Result writable to a LazyObject * @param result the HBase Result Writable containing the row * @return the deserialized object * @see AbstractSerDe#deserialize(Writable) */ @Override public Object deserialize(Writable result) throws SerDeException { if (!(result instanceof ResultWritable)) { throw new SerDeException(getClass().getName() + ": expects ResultWritable!"); } cachedHBaseRow.init(((ResultWritable) result).getResult()); return cachedHBaseRow; }
@Test public void testResult() throws Exception { // Initialize a result KeyValue[] kvs = new KeyValue[] { new KeyValue(Bytes.toBytes("test-row"), Bytes.toBytes("cfa"), Bytes.toBytes("col1"), Bytes.toBytes("cfacol1")), new KeyValue(Bytes.toBytes("test-row"), Bytes.toBytes("cfa"), Bytes.toBytes("col2"), Bytes.toBytes("cfacol2")) }; Result expected = Result.create(kvs); ResultWritable actual = copy(new ResultWritable(expected), new ResultWritable()); Assert.assertArrayEquals(expected.rawCells(), actual.getResult().rawCells()); }
@Override public boolean next(ImmutableBytesWritable key, ResultWritable value) throws IOException { return rr.next(key, value.getResult()); }
/** * Deserialize a row from the HBase Result writable to a LazyObject * @param result the HBase Result Writable containing the row * @return the deserialized object * @see SerDe#deserialize(Writable) */ @Override public Object deserialize(Writable result) throws SerDeException { if (!(result instanceof ResultWritable)) { throw new SerDeException(getClass().getName() + ": expects ResultWritable!"); } cachedHBaseRow.init(((ResultWritable) result).getResult()); return cachedHBaseRow; }