HBASE-12084 Remove deprecated APIs from Result.
This commit is contained in:
parent
011bc04416
commit
1b5e6daef2
|
@ -106,23 +106,6 @@ public class Result implements CellScannable, CellScanner {
|
|||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #create(List)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Result(KeyValue [] cells) {
|
||||
this.cells = cells;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #create(List)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Result(List<KeyValue> kvs) {
|
||||
// TODO: Here we presume the passed in Cells are KVs. One day this won't always be so.
|
||||
this(kvs.toArray(new Cell[kvs.size()]), null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate a Result with the specified List of KeyValues.
|
||||
* <br><strong>Note:</strong> You must ensure that the keyvalues are already sorted.
|
||||
|
@ -202,25 +185,6 @@ public class Result implements CellScannable, CellScanner {
|
|||
return cells;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an cells of a Result as an array of KeyValues
|
||||
*
|
||||
* WARNING do not use, expensive. This does an arraycopy of the cell[]'s value.
|
||||
*
|
||||
* Added to ease transition from 0.94 -> 0.96.
|
||||
*
|
||||
* @deprecated as of 0.96, use {@link #rawCells()}
|
||||
* @return array of KeyValues, empty array if nothing in result.
|
||||
*/
|
||||
@Deprecated
|
||||
public KeyValue[] raw() {
|
||||
KeyValue[] kvs = new KeyValue[cells.length];
|
||||
for (int i = 0 ; i < kvs.length; i++) {
|
||||
kvs[i] = KeyValueUtil.ensureKeyValue(cells[i]);
|
||||
}
|
||||
return kvs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a sorted list of the Cell's in this result.
|
||||
*
|
||||
|
@ -232,29 +196,6 @@ public class Result implements CellScannable, CellScanner {
|
|||
return isEmpty()? null: Arrays.asList(rawCells());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an cells of a Result as an array of KeyValues
|
||||
*
|
||||
* WARNING do not use, expensive. This does an arraycopy of the cell[]'s value.
|
||||
*
|
||||
* Added to ease transition from 0.94 -> 0.96.
|
||||
*
|
||||
* @deprecated as of 0.96, use {@link #listCells()}
|
||||
* @return all sorted List of KeyValues; can be null if no cells in the result
|
||||
*/
|
||||
@Deprecated
|
||||
public List<KeyValue> list() {
|
||||
return isEmpty() ? null : Arrays.asList(raw());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getColumnCells(byte[], byte[])} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public List<KeyValue> getColumn(byte [] family, byte [] qualifier) {
|
||||
return KeyValueUtil.ensureKeyValues(getColumnCells(family, qualifier));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Cells for the specific column. The Cells are sorted in
|
||||
* the {@link KeyValue#COMPARATOR} order. That implies the first entry in
|
||||
|
@ -357,14 +298,6 @@ public class Result implements CellScannable, CellScanner {
|
|||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getColumnLatestCell(byte[], byte[])} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public KeyValue getColumnLatest(byte [] family, byte [] qualifier) {
|
||||
return KeyValueUtil.ensureKeyValue(getColumnLatestCell(family, qualifier));
|
||||
}
|
||||
|
||||
/**
|
||||
* The Cell for the most recent timestamp for a given column.
|
||||
*
|
||||
|
@ -389,16 +322,6 @@ public class Result implements CellScannable, CellScanner {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getColumnLatestCell(byte[], int, int, byte[], int, int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public KeyValue getColumnLatest(byte [] family, int foffset, int flength,
|
||||
byte [] qualifier, int qoffset, int qlength) {
|
||||
return KeyValueUtil.ensureKeyValue(
|
||||
getColumnLatestCell(family, foffset, flength, qualifier, qoffset, qlength));
|
||||
}
|
||||
|
||||
/**
|
||||
* The Cell for the most recent timestamp for a given column.
|
||||
*
|
||||
|
|
|
@ -798,7 +798,7 @@ public class AggregationClient {
|
|||
for (int i = 0; i < results.length; i++) {
|
||||
Result r = results[i];
|
||||
// retrieve weight
|
||||
Cell kv = r.getColumnLatest(colFamily, weightQualifier);
|
||||
Cell kv = r.getColumnLatestCell(colFamily, weightQualifier);
|
||||
R newValue = ci.getValue(colFamily, weightQualifier, kv);
|
||||
S s = ci.castToReturnType(newValue);
|
||||
double newSumVal = movingSumVal + ci.divideForAvg(s, 1L);
|
||||
|
@ -807,7 +807,7 @@ public class AggregationClient {
|
|||
return value;
|
||||
}
|
||||
movingSumVal = newSumVal;
|
||||
kv = r.getColumnLatest(colFamily, qualifier);
|
||||
kv = r.getColumnLatestCell(colFamily, qualifier);
|
||||
value = ci.getValue(colFamily, qualifier, kv);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ public class TableNamespaceManager {
|
|||
ResultScanner scanner = nsTable.getScanner(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES);
|
||||
try {
|
||||
for (Result result : scanner) {
|
||||
byte[] val = CellUtil.cloneValue(result.getColumnLatest(
|
||||
byte[] val = CellUtil.cloneValue(result.getColumnLatestCell(
|
||||
HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
|
||||
HTableDescriptor.NAMESPACE_COL_DESC_BYTES));
|
||||
NamespaceDescriptor ns =
|
||||
|
|
|
@ -4427,8 +4427,8 @@ public class TestFromClientSide {
|
|||
assertEquals(0, Bytes.compareTo(Bytes.add(v2,v1), r.getValue(FAMILY, QUALIFIERS[1])));
|
||||
// QUALIFIERS[2] previously not exist, verify both value and timestamp are correct
|
||||
assertEquals(0, Bytes.compareTo(v2, r.getValue(FAMILY, QUALIFIERS[2])));
|
||||
assertEquals(r.getColumnLatest(FAMILY, QUALIFIERS[0]).getTimestamp(),
|
||||
r.getColumnLatest(FAMILY, QUALIFIERS[2]).getTimestamp());
|
||||
assertEquals(r.getColumnLatestCell(FAMILY, QUALIFIERS[0]).getTimestamp(),
|
||||
r.getColumnLatestCell(FAMILY, QUALIFIERS[2]).getTimestamp());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -5656,8 +5656,8 @@ public class TestFromClientSide {
|
|||
int expectedIndex = 5;
|
||||
for (Result result : scanner) {
|
||||
assertEquals(result.size(), 1);
|
||||
assertTrue(Bytes.equals(result.raw()[0].getRow(), ROWS[expectedIndex]));
|
||||
assertTrue(Bytes.equals(result.raw()[0].getQualifier(),
|
||||
assertTrue(Bytes.equals(result.rawCells()[0].getRow(), ROWS[expectedIndex]));
|
||||
assertTrue(Bytes.equals(result.rawCells()[0].getQualifier(),
|
||||
QUALIFIERS[expectedIndex]));
|
||||
expectedIndex--;
|
||||
}
|
||||
|
@ -5695,8 +5695,8 @@ public class TestFromClientSide {
|
|||
int count = 0;
|
||||
for (Result result : ht.getScanner(scan)) {
|
||||
assertEquals(result.size(), 1);
|
||||
assertEquals(result.raw()[0].getValueLength(), Bytes.SIZEOF_INT);
|
||||
assertEquals(Bytes.toInt(result.raw()[0].getValue()), VALUE.length);
|
||||
assertEquals(result.rawCells()[0].getValueLength(), Bytes.SIZEOF_INT);
|
||||
assertEquals(Bytes.toInt(result.rawCells()[0].getValue()), VALUE.length);
|
||||
count++;
|
||||
}
|
||||
assertEquals(count, 10);
|
||||
|
@ -5979,15 +5979,15 @@ public class TestFromClientSide {
|
|||
result = scanner.next();
|
||||
assertTrue("Expected 2 keys but received " + result.size(),
|
||||
result.size() == 2);
|
||||
assertTrue(Bytes.equals(result.raw()[0].getRow(), ROWS[4]));
|
||||
assertTrue(Bytes.equals(result.raw()[1].getRow(), ROWS[4]));
|
||||
assertTrue(Bytes.equals(result.raw()[0].getValue(), VALUES[1]));
|
||||
assertTrue(Bytes.equals(result.raw()[1].getValue(), VALUES[2]));
|
||||
assertTrue(Bytes.equals(result.rawCells()[0].getRow(), ROWS[4]));
|
||||
assertTrue(Bytes.equals(result.rawCells()[1].getRow(), ROWS[4]));
|
||||
assertTrue(Bytes.equals(result.rawCells()[0].getValue(), VALUES[1]));
|
||||
assertTrue(Bytes.equals(result.rawCells()[1].getValue(), VALUES[2]));
|
||||
result = scanner.next();
|
||||
assertTrue("Expected 1 key but received " + result.size(),
|
||||
result.size() == 1);
|
||||
assertTrue(Bytes.equals(result.raw()[0].getRow(), ROWS[3]));
|
||||
assertTrue(Bytes.equals(result.raw()[0].getValue(), VALUES[0]));
|
||||
assertTrue(Bytes.equals(result.rawCells()[0].getRow(), ROWS[3]));
|
||||
assertTrue(Bytes.equals(result.rawCells()[0].getValue(), VALUES[0]));
|
||||
scanner.close();
|
||||
ht.close();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import junit.framework.Assert;
|
|||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.hbase.Cell;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
|
@ -93,13 +94,13 @@ public class TestScannerWithBulkload {
|
|||
scanner = table.getScanner(scan);
|
||||
result = scanner.next();
|
||||
while (result != null) {
|
||||
List<KeyValue> kvs = result.getColumn(Bytes.toBytes("col"), Bytes.toBytes("q"));
|
||||
for (KeyValue _kv : kvs) {
|
||||
if (Bytes.toString(_kv.getRow()).equals("row1")) {
|
||||
System.out.println(Bytes.toString(_kv.getRow()));
|
||||
System.out.println(Bytes.toString(_kv.getQualifier()));
|
||||
System.out.println(Bytes.toString(_kv.getValue()));
|
||||
Assert.assertEquals("version3", Bytes.toString(_kv.getValue()));
|
||||
List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
|
||||
for (Cell _c : cells) {
|
||||
if (Bytes.toString(_c.getRow()).equals("row1")) {
|
||||
System.out.println(Bytes.toString(_c.getRow()));
|
||||
System.out.println(Bytes.toString(_c.getQualifier()));
|
||||
System.out.println(Bytes.toString(_c.getValue()));
|
||||
Assert.assertEquals("version3", Bytes.toString(_c.getValue()));
|
||||
}
|
||||
}
|
||||
result = scanner.next();
|
||||
|
@ -111,13 +112,13 @@ public class TestScannerWithBulkload {
|
|||
private Result scanAfterBulkLoad(ResultScanner scanner, Result result, String expctedVal)
|
||||
throws IOException {
|
||||
while (result != null) {
|
||||
List<KeyValue> kvs = result.getColumn(Bytes.toBytes("col"), Bytes.toBytes("q"));
|
||||
for (KeyValue _kv : kvs) {
|
||||
if (Bytes.toString(_kv.getRow()).equals("row1")) {
|
||||
System.out.println(Bytes.toString(_kv.getRow()));
|
||||
System.out.println(Bytes.toString(_kv.getQualifier()));
|
||||
System.out.println(Bytes.toString(_kv.getValue()));
|
||||
Assert.assertEquals(expctedVal, Bytes.toString(_kv.getValue()));
|
||||
List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
|
||||
for (Cell _c : cells) {
|
||||
if (Bytes.toString(_c.getRow()).equals("row1")) {
|
||||
System.out.println(Bytes.toString(_c.getRow()));
|
||||
System.out.println(Bytes.toString(_c.getQualifier()));
|
||||
System.out.println(Bytes.toString(_c.getValue()));
|
||||
Assert.assertEquals(expctedVal, Bytes.toString(_c.getValue()));
|
||||
}
|
||||
}
|
||||
result = scanner.next();
|
||||
|
@ -188,9 +189,9 @@ public class TestScannerWithBulkload {
|
|||
|
||||
ResultScanner scanner = table.getScanner(scan);
|
||||
Result result = scanner.next();
|
||||
List<KeyValue> kvs = result.getColumn(Bytes.toBytes("col"), Bytes.toBytes("q"));
|
||||
Assert.assertEquals(1, kvs.size());
|
||||
Assert.assertEquals("version1", Bytes.toString(kvs.get(0).getValue()));
|
||||
List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
|
||||
Assert.assertEquals(1, cells.size());
|
||||
Assert.assertEquals("version1", Bytes.toString(cells.get(0).getValue()));
|
||||
scanner.close();
|
||||
return table;
|
||||
}
|
||||
|
@ -266,13 +267,13 @@ public class TestScannerWithBulkload {
|
|||
scanner = table.getScanner(scan);
|
||||
result = scanner.next();
|
||||
while (result != null) {
|
||||
List<KeyValue> kvs = result.getColumn(Bytes.toBytes("col"), Bytes.toBytes("q"));
|
||||
for (KeyValue _kv : kvs) {
|
||||
if (Bytes.toString(_kv.getRow()).equals("row1")) {
|
||||
System.out.println(Bytes.toString(_kv.getRow()));
|
||||
System.out.println(Bytes.toString(_kv.getQualifier()));
|
||||
System.out.println(Bytes.toString(_kv.getValue()));
|
||||
Assert.assertEquals("version3", Bytes.toString(_kv.getValue()));
|
||||
List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
|
||||
for (Cell _c : cells) {
|
||||
if (Bytes.toString(_c.getRow()).equals("row1")) {
|
||||
System.out.println(Bytes.toString(_c.getRow()));
|
||||
System.out.println(Bytes.toString(_c.getQualifier()));
|
||||
System.out.println(Bytes.toString(_c.getValue()));
|
||||
Assert.assertEquals("version3", Bytes.toString(_c.getValue()));
|
||||
}
|
||||
}
|
||||
result = scanner.next();
|
||||
|
|
Loading…
Reference in New Issue