HBASE-21918 the use cases in doc should use Cell instead of KeyValue
Signed-off-by: Xu Cang <xcang@salesforce.com> Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
9e273b3f3e
commit
e46dc61569
|
@ -452,8 +452,8 @@ scan.setFilter(f);
|
||||||
scan.setBatch(10); // set this if there could be many columns returned
|
scan.setBatch(10); // set this if there could be many columns returned
|
||||||
ResultScanner rs = t.getScanner(scan);
|
ResultScanner rs = t.getScanner(scan);
|
||||||
for (Result r = rs.next(); r != null; r = rs.next()) {
|
for (Result r = rs.next(); r != null; r = rs.next()) {
|
||||||
for (KeyValue kv : r.raw()) {
|
for (Cell cell : result.listCells()) {
|
||||||
// each kv represents a column
|
// each cell represents a column
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
@ -482,8 +482,8 @@ scan.setFilter(f);
|
||||||
scan.setBatch(10); // set this if there could be many columns returned
|
scan.setBatch(10); // set this if there could be many columns returned
|
||||||
ResultScanner rs = t.getScanner(scan);
|
ResultScanner rs = t.getScanner(scan);
|
||||||
for (Result r = rs.next(); r != null; r = rs.next()) {
|
for (Result r = rs.next(); r != null; r = rs.next()) {
|
||||||
for (KeyValue kv : r.raw()) {
|
for (Cell cell : result.listCells()) {
|
||||||
// each kv represents a column
|
// each cell represents a column
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
@ -518,8 +518,8 @@ scan.setFilter(f);
|
||||||
scan.setBatch(10); // set this if there could be many columns returned
|
scan.setBatch(10); // set this if there could be many columns returned
|
||||||
ResultScanner rs = t.getScanner(scan);
|
ResultScanner rs = t.getScanner(scan);
|
||||||
for (Result r = rs.next(); r != null; r = rs.next()) {
|
for (Result r = rs.next(); r != null; r = rs.next()) {
|
||||||
for (KeyValue kv : r.raw()) {
|
for (Cell cell : result.listCells()) {
|
||||||
// each kv represents a column
|
// each cell represents a column
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
|
@ -425,7 +425,7 @@ Get get = new Get(Bytes.toBytes("row1"));
|
||||||
get.setMaxVersions(3); // will return last 3 versions of row
|
get.setMaxVersions(3); // will return last 3 versions of row
|
||||||
Result r = table.get(get);
|
Result r = table.get(get);
|
||||||
byte[] b = r.getValue(CF, ATTR); // returns current version of value
|
byte[] b = r.getValue(CF, ATTR); // returns current version of value
|
||||||
List<KeyValue> kv = r.getColumn(CF, ATTR); // returns all versions of this column
|
List<Cell> cells = r.getColumnCells(CF, ATTR); // returns all versions of this column
|
||||||
----
|
----
|
||||||
|
|
||||||
==== Put
|
==== Put
|
||||||
|
|
|
@ -417,8 +417,8 @@ public static class MyMapper extends TableMapper<ImmutableBytesWritable, Put> {
|
||||||
|
|
||||||
private static Put resultToPut(ImmutableBytesWritable key, Result result) throws IOException {
|
private static Put resultToPut(ImmutableBytesWritable key, Result result) throws IOException {
|
||||||
Put put = new Put(key.get());
|
Put put = new Put(key.get());
|
||||||
for (KeyValue kv : result.raw()) {
|
for (Cell cell : result.listCells()) {
|
||||||
put.add(kv);
|
put.add(cell);
|
||||||
}
|
}
|
||||||
return put;
|
return put;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue