HBASE-9477 Add deprecation compat shim for Result#raw and Result#list for 0.96
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1521633 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5e6b63d6fc
commit
95b202008d
|
@ -376,7 +376,7 @@ public class ClientScanner extends AbstractClientScanner {
|
|||
if (values != null && values.length > 0) {
|
||||
for (Result rs : values) {
|
||||
cache.add(rs);
|
||||
for (Cell kv : rs.raw()) {
|
||||
for (Cell kv : rs.rawCells()) {
|
||||
// TODO make method in Cell or CellUtil
|
||||
remainingResultSize -= KeyValueUtil.ensureKeyValue(kv).heapSize();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ import org.apache.hadoop.hbase.util.Bytes;
|
|||
* A Result is backed by an array of {@link KeyValue} objects, each representing
|
||||
* an HBase cell defined by the row, family, qualifier, timestamp, and value.<p>
|
||||
*
|
||||
* The underlying {@link KeyValue} objects can be accessed through the method {@link #list()}.
|
||||
* The underlying {@link KeyValue} objects can be accessed through the method {@link #listCells()}.
|
||||
* Each KeyValue can then be accessed through
|
||||
* {@link KeyValue#getRow()}, {@link KeyValue#getFamily()}, {@link KeyValue#getQualifier()},
|
||||
* {@link KeyValue#getTimestamp()}, and {@link KeyValue#getValue()}.<p>
|
||||
|
@ -85,7 +85,7 @@ public class Result implements CellScannable {
|
|||
public static final Result EMPTY_RESULT = new Result();
|
||||
|
||||
/**
|
||||
* Creates an empty Result w/ no KeyValue payload; returns null if you call {@link #raw()}.
|
||||
* Creates an empty Result w/ no KeyValue payload; returns null if you call {@link #rawCells()}.
|
||||
* Use this to represent no results if <code>null</code> won't do or in old 'mapred' as oppposed to 'mapreduce' package
|
||||
* MapReduce where you need to overwrite a Result
|
||||
* instance with a {@link #copyFrom(Result)} call.
|
||||
|
@ -147,20 +147,55 @@ public class Result implements CellScannable {
|
|||
*
|
||||
* @return array of Cells; can be null if nothing in the result
|
||||
*/
|
||||
public Cell[] raw() {
|
||||
public Cell[] rawCells() {
|
||||
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.
|
||||
*
|
||||
* Since HBase 0.20.5 this is equivalent to raw().
|
||||
*
|
||||
* @return The sorted list of Cell's.
|
||||
* @return sorted List of Cells; can be null if no cells in the result
|
||||
*/
|
||||
public List<Cell> list() {
|
||||
return isEmpty()? null: Arrays.asList(raw());
|
||||
public List<Cell> listCells() {
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the Cells for the specific column. The Cells are sorted in
|
||||
|
@ -180,7 +215,7 @@ public class Result implements CellScannable {
|
|||
public List<Cell> getColumn(byte [] family, byte [] qualifier) {
|
||||
List<Cell> result = new ArrayList<Cell>();
|
||||
|
||||
Cell [] kvs = raw();
|
||||
Cell [] kvs = rawCells();
|
||||
|
||||
if (kvs == null || kvs.length == 0) {
|
||||
return result;
|
||||
|
@ -275,7 +310,7 @@ public class Result implements CellScannable {
|
|||
* selected in the query (Get/Scan)
|
||||
*/
|
||||
public Cell getColumnLatest(byte [] family, byte [] qualifier) {
|
||||
Cell [] kvs = raw(); // side effect possibly.
|
||||
Cell [] kvs = rawCells(); // side effect possibly.
|
||||
if (kvs == null || kvs.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -306,7 +341,7 @@ public class Result implements CellScannable {
|
|||
public Cell getColumnLatest(byte [] family, int foffset, int flength,
|
||||
byte [] qualifier, int qoffset, int qlength) {
|
||||
|
||||
Cell [] kvs = raw(); // side effect possibly.
|
||||
Cell [] kvs = rawCells(); // side effect possibly.
|
||||
if (kvs == null || kvs.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -692,8 +727,8 @@ public class Result implements CellScannable {
|
|||
throw new Exception("This row doesn't have the same number of KVs: "
|
||||
+ res1.toString() + " compared to " + res2.toString());
|
||||
}
|
||||
Cell[] ourKVs = res1.raw();
|
||||
Cell[] replicatedKVs = res2.raw();
|
||||
Cell[] ourKVs = res1.rawCells();
|
||||
Cell[] replicatedKVs = res2.rawCells();
|
||||
for (int i = 0; i < res1.size(); i++) {
|
||||
if (!ourKVs[i].equals(replicatedKVs[i]) ||
|
||||
!Bytes.equals(CellUtil.getValueArray(ourKVs[i]), CellUtil.getValueArray(replicatedKVs[i]))) {
|
||||
|
|
|
@ -253,7 +253,7 @@ public class ScannerCallable extends RegionServerCallable<Result[]> {
|
|||
}
|
||||
long resultSize = 0;
|
||||
for (Result rr : rrs) {
|
||||
for (Cell kv : rr.raw()) {
|
||||
for (Cell kv : rr.rawCells()) {
|
||||
// TODO add getLength to Cell/use CellUtil#estimatedSizeOf
|
||||
resultSize += KeyValueUtil.ensureKeyValue(kv).getLength();
|
||||
}
|
||||
|
|
|
@ -1026,7 +1026,7 @@ public final class ProtobufUtil {
|
|||
*/
|
||||
public static ClientProtos.Result toResult(final Result result) {
|
||||
ClientProtos.Result.Builder builder = ClientProtos.Result.newBuilder();
|
||||
Cell [] cells = result.raw();
|
||||
Cell [] cells = result.rawCells();
|
||||
if (cells != null) {
|
||||
for (Cell c : cells) {
|
||||
builder.addCell(toCell(c));
|
||||
|
|
|
@ -154,7 +154,7 @@ public class IntegrationTestImportTsv implements Configurable, Tool {
|
|||
Iterator<KeyValue> expectedIt = simple_expected.iterator();
|
||||
while (resultsIt.hasNext() && expectedIt.hasNext()) {
|
||||
Result r = resultsIt.next();
|
||||
for (Cell actual : r.raw()) {
|
||||
for (Cell actual : r.rawCells()) {
|
||||
assertTrue(
|
||||
"Ran out of expected values prematurely!",
|
||||
expectedIt.hasNext());
|
||||
|
|
|
@ -248,7 +248,7 @@ public class IntegrationTestLoadAndVerify extends IntegrationTestBase {
|
|||
throws IOException, InterruptedException {
|
||||
BytesWritable bwKey = new BytesWritable(key.get());
|
||||
BytesWritable bwVal = new BytesWritable();
|
||||
for (Cell kv : value.list()) {
|
||||
for (Cell kv : value.listCells()) {
|
||||
if (Bytes.compareTo(TEST_QUALIFIER, 0, TEST_QUALIFIER.length,
|
||||
kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength()) == 0) {
|
||||
context.write(bwKey, EMPTY);
|
||||
|
|
|
@ -116,7 +116,7 @@ implements TableMap<ImmutableBytesWritable,Result> {
|
|||
ArrayList<byte[]> foundList = new ArrayList<byte[]>();
|
||||
int numCols = columns.length;
|
||||
if (numCols > 0) {
|
||||
for (Cell value: r.list()) {
|
||||
for (Cell value: r.listCells()) {
|
||||
byte [] column = KeyValue.makeColumn(CellUtil.getFamilyArray(value),
|
||||
CellUtil.getQualifierArray(value));
|
||||
for (int i = 0; i < numCols; i++) {
|
||||
|
|
|
@ -116,7 +116,7 @@ public class CellCounter {
|
|||
context.getCounter(Counters.ROWS).increment(1);
|
||||
context.write(new Text("Total ROWS"), new IntWritable(1));
|
||||
|
||||
for (Cell value : values.list()) {
|
||||
for (Cell value : values.listCells()) {
|
||||
currentRowKey = Bytes.toStringBinary(CellUtil.getRowArray(value));
|
||||
String thisRowFamilyName = Bytes.toStringBinary(CellUtil.getFamilyArray(value));
|
||||
if (!thisRowFamilyName.equals(currentFamilyName)) {
|
||||
|
|
|
@ -109,7 +109,7 @@ extends TableMapper<ImmutableBytesWritable,Result> implements Configurable {
|
|||
ArrayList<byte[]> foundList = new ArrayList<byte[]>();
|
||||
int numCols = columns.length;
|
||||
if (numCols > 0) {
|
||||
for (Cell value: r.list()) {
|
||||
for (Cell value: r.listCells()) {
|
||||
byte [] column = KeyValue.makeColumn(CellUtil.getFamilyArray(value),
|
||||
CellUtil.getQualifierArray(value));
|
||||
for (int i = 0; i < numCols; i++) {
|
||||
|
|
|
@ -93,7 +93,7 @@ public class Import {
|
|||
Context context)
|
||||
throws IOException {
|
||||
try {
|
||||
for (Cell kv : value.raw()) {
|
||||
for (Cell kv : value.rawCells()) {
|
||||
kv = filterKv(kv);
|
||||
// skip if we filtered it out
|
||||
if (kv == null) continue;
|
||||
|
@ -143,7 +143,7 @@ public class Import {
|
|||
throws IOException, InterruptedException {
|
||||
Put put = null;
|
||||
Delete delete = null;
|
||||
for (Cell kv : result.raw()) {
|
||||
for (Cell kv : result.rawCells()) {
|
||||
kv = filterKv(kv);
|
||||
// skip if we filter it out
|
||||
if (kv == null) continue;
|
||||
|
|
|
@ -3070,7 +3070,7 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa
|
|||
if (!results.isEmpty()) {
|
||||
for (Result r : results) {
|
||||
if (maxScannerResultSize < Long.MAX_VALUE){
|
||||
for (Cell kv : r.raw()) {
|
||||
for (Cell kv : r.rawCells()) {
|
||||
// TODO
|
||||
currentScanResultSize += KeyValueUtil.ensureKeyValue(kv).heapSize();
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class RowResultGenerator extends ResultGenerator {
|
|||
}
|
||||
Result result = table.get(get);
|
||||
if (result != null && !result.isEmpty()) {
|
||||
valuesI = result.list().iterator();
|
||||
valuesI = result.listCells().iterator();
|
||||
}
|
||||
} catch (DoNotRetryIOException e) {
|
||||
// Warn here because Stargate will return 404 in the case if multiple
|
||||
|
|
|
@ -149,7 +149,7 @@ public class ScannerResultGenerator extends ResultGenerator {
|
|||
}
|
||||
}
|
||||
if (cached != null) {
|
||||
rowI = cached.list().iterator();
|
||||
rowI = cached.listCells().iterator();
|
||||
loop = true;
|
||||
cached = null;
|
||||
} else {
|
||||
|
@ -162,7 +162,7 @@ public class ScannerResultGenerator extends ResultGenerator {
|
|||
LOG.error(StringUtils.stringifyException(e));
|
||||
}
|
||||
if (result != null && !result.isEmpty()) {
|
||||
rowI = result.list().iterator();
|
||||
rowI = result.listCells().iterator();
|
||||
loop = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -513,7 +513,7 @@ public class AccessControlLists {
|
|||
byte[] entryName, Result result) {
|
||||
ListMultimap<String, TablePermission> perms = ArrayListMultimap.create();
|
||||
if (result != null && result.size() > 0) {
|
||||
for (Cell kv : result.raw()) {
|
||||
for (Cell kv : result.rawCells()) {
|
||||
|
||||
Pair<String,TablePermission> permissionsOfUserOnTable =
|
||||
parsePermissionRecord(entryName, kv);
|
||||
|
|
|
@ -672,7 +672,7 @@ public class ThriftServerRunner implements Runnable {
|
|||
get.addColumn(family, qualifier);
|
||||
}
|
||||
Result result = table.get(get);
|
||||
return ThriftUtilities.cellFromHBase(result.raw());
|
||||
return ThriftUtilities.cellFromHBase(result.rawCells());
|
||||
} catch (IOException e) {
|
||||
LOG.warn(e.getMessage(), e);
|
||||
throw new IOError(e.getMessage());
|
||||
|
@ -704,7 +704,7 @@ public class ThriftServerRunner implements Runnable {
|
|||
get.addColumn(family, qualifier);
|
||||
get.setMaxVersions(numVersions);
|
||||
Result result = table.get(get);
|
||||
return ThriftUtilities.cellFromHBase(result.raw());
|
||||
return ThriftUtilities.cellFromHBase(result.rawCells());
|
||||
} catch (IOException e) {
|
||||
LOG.warn(e.getMessage(), e);
|
||||
throw new IOError(e.getMessage());
|
||||
|
@ -740,7 +740,7 @@ public class ThriftServerRunner implements Runnable {
|
|||
get.setTimeRange(0, timestamp);
|
||||
get.setMaxVersions(numVersions);
|
||||
Result result = table.get(get);
|
||||
return ThriftUtilities.cellFromHBase(result.raw());
|
||||
return ThriftUtilities.cellFromHBase(result.rawCells());
|
||||
} catch (IOException e) {
|
||||
LOG.warn(e.getMessage(), e);
|
||||
throw new IOError(e.getMessage());
|
||||
|
@ -1371,7 +1371,7 @@ public class ThriftServerRunner implements Runnable {
|
|||
try {
|
||||
HTable table = getTable(getBytes(tableName));
|
||||
Result result = table.getRowOrBefore(getBytes(row), getBytes(family));
|
||||
return ThriftUtilities.cellFromHBase(result.raw());
|
||||
return ThriftUtilities.cellFromHBase(result.rawCells());
|
||||
} catch (IOException e) {
|
||||
LOG.warn(e.getMessage(), e);
|
||||
throw new IOError(e.getMessage());
|
||||
|
|
|
@ -152,7 +152,7 @@ public class ThriftUtilities {
|
|||
result.row = ByteBuffer.wrap(result_.getRow());
|
||||
if (sortColumns) {
|
||||
result.sortedColumns = new ArrayList<TColumn>();
|
||||
for (Cell kv : result_.raw()) {
|
||||
for (Cell kv : result_.rawCells()) {
|
||||
result.sortedColumns.add(new TColumn(
|
||||
ByteBuffer.wrap(KeyValue.makeColumn(CellUtil.getFamilyArray(kv),
|
||||
CellUtil.getQualifierArray(kv))),
|
||||
|
@ -160,7 +160,7 @@ public class ThriftUtilities {
|
|||
}
|
||||
} else {
|
||||
result.columns = new TreeMap<ByteBuffer, TCell>();
|
||||
for (Cell kv : result_.raw()) {
|
||||
for (Cell kv : result_.rawCells()) {
|
||||
result.columns.put(
|
||||
ByteBuffer.wrap(KeyValue.makeColumn(CellUtil.getFamilyArray(kv),
|
||||
CellUtil.getQualifierArray(kv))),
|
||||
|
|
|
@ -140,7 +140,7 @@ public class ThriftUtilities {
|
|||
* @return converted result, returns an empty result if the input is <code>null</code>
|
||||
*/
|
||||
public static TResult resultFromHBase(Result in) {
|
||||
Cell[] raw = in.raw();
|
||||
Cell[] raw = in.rawCells();
|
||||
TResult out = new TResult();
|
||||
byte[] row = in.getRow();
|
||||
if (row != null) {
|
||||
|
|
|
@ -2570,8 +2570,8 @@ public class HBaseFsck extends Configured implements Tool {
|
|||
public boolean processRow(Result result) throws IOException {
|
||||
try {
|
||||
|
||||
// record the latest modification of this hbase:meta record
|
||||
long ts = Collections.max(result.list(), comp).getTimestamp();
|
||||
// record the latest modification of this META record
|
||||
long ts = Collections.max(result.listCells(), comp).getTimestamp();
|
||||
Pair<HRegionInfo, ServerName> pair = HRegionInfo.getHRegionInfoAndServerName(result);
|
||||
if (pair == null || pair.getFirst() == null) {
|
||||
emptyRegionInfoQualifiers.add(result);
|
||||
|
|
|
@ -535,7 +535,7 @@ public abstract class HBaseTestCase extends TestCase {
|
|||
return false;
|
||||
}
|
||||
values.clear();
|
||||
values.addAll(results.list());
|
||||
values.addAll(results.listCells());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ public class TestAcidGuarantees implements Tool {
|
|||
msg.append("Failed after ").append(numVerified).append("!");
|
||||
msg.append("Expected=").append(Bytes.toStringBinary(expected));
|
||||
msg.append("Got:\n");
|
||||
for (Cell kv : res.list()) {
|
||||
for (Cell kv : res.listCells()) {
|
||||
msg.append(kv.toString());
|
||||
msg.append(" val= ");
|
||||
msg.append(Bytes.toStringBinary(CellUtil.getValueArray(kv)));
|
||||
|
@ -230,7 +230,7 @@ public class TestAcidGuarantees implements Tool {
|
|||
msg.append("Failed after ").append(numRowsScanned).append("!");
|
||||
msg.append("Expected=").append(Bytes.toStringBinary(expected));
|
||||
msg.append("Got:\n");
|
||||
for (Cell kv : res.list()) {
|
||||
for (Cell kv : res.listCells()) {
|
||||
msg.append(kv.toString());
|
||||
msg.append(" val= ");
|
||||
msg.append(Bytes.toStringBinary(CellUtil.getValueArray(kv)));
|
||||
|
|
|
@ -236,7 +236,7 @@ public class TestMultiVersions {
|
|||
get.setTimeStamp(timestamp[j]);
|
||||
Result result = table.get(get);
|
||||
int cellCount = 0;
|
||||
for(@SuppressWarnings("unused")Cell kv : result.list()) {
|
||||
for(@SuppressWarnings("unused")Cell kv : result.listCells()) {
|
||||
cellCount++;
|
||||
}
|
||||
assertTrue(cellCount == 1);
|
||||
|
|
|
@ -107,7 +107,7 @@ public class TimestampTestBase extends HBaseTestCase {
|
|||
get.setMaxVersions(3);
|
||||
Result result = incommon.get(get);
|
||||
assertEquals(1, result.size());
|
||||
long time = Bytes.toLong(CellUtil.getValueArray(result.raw()[0]));
|
||||
long time = Bytes.toLong(CellUtil.getValueArray(result.rawCells()[0]));
|
||||
assertEquals(time, currentTime);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class TimestampTestBase extends HBaseTestCase {
|
|||
get.addColumn(FAMILY_NAME, QUALIFIER_NAME);
|
||||
get.setMaxVersions(tss.length);
|
||||
Result result = incommon.get(get);
|
||||
Cell [] kvs = result.raw();
|
||||
Cell [] kvs = result.rawCells();
|
||||
assertEquals(kvs.length, tss.length);
|
||||
for(int i=0;i<kvs.length;i++) {
|
||||
t = Bytes.toLong(CellUtil.getValueArray(kvs[i]));
|
||||
|
@ -152,7 +152,7 @@ public class TimestampTestBase extends HBaseTestCase {
|
|||
get.setTimeRange(0, maxStamp);
|
||||
get.setMaxVersions(kvs.length - 1);
|
||||
result = incommon.get(get);
|
||||
kvs = result.raw();
|
||||
kvs = result.rawCells();
|
||||
assertEquals(kvs.length, tss.length - 1);
|
||||
for(int i=1;i<kvs.length;i++) {
|
||||
t = Bytes.toLong(CellUtil.getValueArray(kvs[i-1]));
|
||||
|
|
|
@ -207,7 +207,7 @@ public class TestFromClientSide {
|
|||
s.setTimeRange(0, ts+3);
|
||||
s.setMaxVersions();
|
||||
ResultScanner scanner = h.getScanner(s);
|
||||
Cell[] kvs = scanner.next().raw();
|
||||
Cell[] kvs = scanner.next().rawCells();
|
||||
assertArrayEquals(T2, CellUtil.getValueArray(kvs[0]));
|
||||
assertArrayEquals(T1, CellUtil.getValueArray(kvs[1]));
|
||||
scanner.close();
|
||||
|
@ -216,7 +216,7 @@ public class TestFromClientSide {
|
|||
s.setRaw(true);
|
||||
s.setMaxVersions();
|
||||
scanner = h.getScanner(s);
|
||||
kvs = scanner.next().raw();
|
||||
kvs = scanner.next().rawCells();
|
||||
assertTrue(CellUtil.isDeleteFamily(kvs[0]));
|
||||
assertArrayEquals(T3, CellUtil.getValueArray(kvs[1]));
|
||||
assertTrue(CellUtil.isDelete(kvs[2]));
|
||||
|
@ -477,7 +477,7 @@ public class TestFromClientSide {
|
|||
while (scanner.hasNext()) {
|
||||
Result result = scanner.next();
|
||||
System.out.println("Got back key: " + Bytes.toString(result.getRow()));
|
||||
for (Cell kv : result.raw()) {
|
||||
for (Cell kv : result.rawCells()) {
|
||||
System.out.println("kv=" + kv.toString() + ", "
|
||||
+ Bytes.toString(CellUtil.getValueArray(kv)));
|
||||
}
|
||||
|
@ -748,8 +748,8 @@ public class TestFromClientSide {
|
|||
int expectedIndex = 1;
|
||||
for(Result result : ht.getScanner(scan)) {
|
||||
assertEquals(result.size(), 1);
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.raw()[0]), ROWS[expectedIndex]));
|
||||
assertTrue(Bytes.equals(CellUtil.getQualifierArray(result.raw()[0]),
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.rawCells()[0]), ROWS[expectedIndex]));
|
||||
assertTrue(Bytes.equals(CellUtil.getQualifierArray(result.rawCells()[0]),
|
||||
QUALIFIERS[expectedIndex]));
|
||||
expectedIndex++;
|
||||
}
|
||||
|
@ -783,8 +783,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(CellUtil.getValueArray(result.raw()[0])), VALUE.length);
|
||||
assertEquals(result.rawCells()[0].getValueLength(), Bytes.SIZEOF_INT);
|
||||
assertEquals(Bytes.toInt(CellUtil.getValueArray(result.rawCells()[0])), VALUE.length);
|
||||
count++;
|
||||
}
|
||||
assertEquals(count, 10);
|
||||
|
@ -2135,15 +2135,15 @@ public class TestFromClientSide {
|
|||
result = scanner.next();
|
||||
assertTrue("Expected 1 key but received " + result.size(),
|
||||
result.size() == 1);
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.raw()[0]), ROWS[3]));
|
||||
assertTrue(Bytes.equals(CellUtil.getValueArray(result.raw()[0]), VALUES[0]));
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.rawCells()[0]), ROWS[3]));
|
||||
assertTrue(Bytes.equals(CellUtil.getValueArray(result.rawCells()[0]), VALUES[0]));
|
||||
result = scanner.next();
|
||||
assertTrue("Expected 2 keys but received " + result.size(),
|
||||
result.size() == 2);
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.raw()[0]), ROWS[4]));
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.raw()[1]), ROWS[4]));
|
||||
assertTrue(Bytes.equals(CellUtil.getValueArray(result.raw()[0]), VALUES[1]));
|
||||
assertTrue(Bytes.equals(CellUtil.getValueArray(result.raw()[1]), VALUES[2]));
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.rawCells()[0]), ROWS[4]));
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.rawCells()[1]), ROWS[4]));
|
||||
assertTrue(Bytes.equals(CellUtil.getValueArray(result.rawCells()[0]), VALUES[1]));
|
||||
assertTrue(Bytes.equals(CellUtil.getValueArray(result.rawCells()[1]), VALUES[2]));
|
||||
scanner.close();
|
||||
|
||||
// Add test of bulk deleting.
|
||||
|
@ -2271,7 +2271,7 @@ public class TestFromClientSide {
|
|||
Get get = new Get(ROWS[numRows-1]);
|
||||
Result result = ht.get(get);
|
||||
assertNumKeys(result, numColsPerRow);
|
||||
Cell [] keys = result.raw();
|
||||
Cell [] keys = result.rawCells();
|
||||
for(int i=0;i<result.size();i++) {
|
||||
assertKey(keys[i], ROWS[numRows-1], FAMILY, QUALIFIERS[i], QUALIFIERS[i]);
|
||||
}
|
||||
|
@ -2282,7 +2282,7 @@ public class TestFromClientSide {
|
|||
int rowCount = 0;
|
||||
while((result = scanner.next()) != null) {
|
||||
assertNumKeys(result, numColsPerRow);
|
||||
Cell [] kvs = result.raw();
|
||||
Cell [] kvs = result.rawCells();
|
||||
for(int i=0;i<numColsPerRow;i++) {
|
||||
assertKey(kvs[i], ROWS[rowCount], FAMILY, QUALIFIERS[i], QUALIFIERS[i]);
|
||||
}
|
||||
|
@ -2300,7 +2300,7 @@ public class TestFromClientSide {
|
|||
get = new Get(ROWS[numRows-1]);
|
||||
result = ht.get(get);
|
||||
assertNumKeys(result, numColsPerRow);
|
||||
keys = result.raw();
|
||||
keys = result.rawCells();
|
||||
for(int i=0;i<result.size();i++) {
|
||||
assertKey(keys[i], ROWS[numRows-1], FAMILY, QUALIFIERS[i], QUALIFIERS[i]);
|
||||
}
|
||||
|
@ -2311,7 +2311,7 @@ public class TestFromClientSide {
|
|||
rowCount = 0;
|
||||
while((result = scanner.next()) != null) {
|
||||
assertNumKeys(result, numColsPerRow);
|
||||
Cell [] kvs = result.raw();
|
||||
Cell [] kvs = result.rawCells();
|
||||
for(int i=0;i<numColsPerRow;i++) {
|
||||
assertKey(kvs[i], ROWS[rowCount], FAMILY, QUALIFIERS[i], QUALIFIERS[i]);
|
||||
}
|
||||
|
@ -3133,7 +3133,7 @@ public class TestFromClientSide {
|
|||
assertTrue("Expected " + idxs.length + " keys but result contains "
|
||||
+ result.size(), result.size() == idxs.length);
|
||||
|
||||
Cell [] keys = result.raw();
|
||||
Cell [] keys = result.rawCells();
|
||||
|
||||
for(int i=0;i<keys.length;i++) {
|
||||
byte [] family = families[idxs[i][0]];
|
||||
|
@ -3166,7 +3166,7 @@ public class TestFromClientSide {
|
|||
int expectedResults = end - start + 1;
|
||||
assertEquals(expectedResults, result.size());
|
||||
|
||||
Cell[] keys = result.raw();
|
||||
Cell[] keys = result.rawCells();
|
||||
|
||||
for (int i=0; i<keys.length; i++) {
|
||||
byte [] value = values[end-i];
|
||||
|
@ -3200,7 +3200,7 @@ public class TestFromClientSide {
|
|||
equals(row, result.getRow()));
|
||||
assertTrue("Expected two keys but result contains " + result.size(),
|
||||
result.size() == 2);
|
||||
Cell [] kv = result.raw();
|
||||
Cell [] kv = result.rawCells();
|
||||
Cell kvA = kv[0];
|
||||
assertTrue("(A) Expected family [" + Bytes.toString(familyA) + "] " +
|
||||
"Got family [" + Bytes.toString(CellUtil.getFamilyArray(kvA)) + "]",
|
||||
|
@ -3231,7 +3231,7 @@ public class TestFromClientSide {
|
|||
equals(row, result.getRow()));
|
||||
assertTrue("Expected a single key but result contains " + result.size(),
|
||||
result.size() == 1);
|
||||
Cell kv = result.raw()[0];
|
||||
Cell kv = result.rawCells()[0];
|
||||
assertTrue("Expected family [" + Bytes.toString(family) + "] " +
|
||||
"Got family [" + Bytes.toString(CellUtil.getFamilyArray(kv)) + "]",
|
||||
equals(family, CellUtil.getFamilyArray(kv)));
|
||||
|
@ -3251,7 +3251,7 @@ public class TestFromClientSide {
|
|||
equals(row, result.getRow()));
|
||||
assertTrue("Expected a single key but result contains " + result.size(),
|
||||
result.size() == 1);
|
||||
Cell kv = result.raw()[0];
|
||||
Cell kv = result.rawCells()[0];
|
||||
assertTrue("Expected family [" + Bytes.toString(family) + "] " +
|
||||
"Got family [" + Bytes.toString(CellUtil.getFamilyArray(kv)) + "]",
|
||||
equals(family, CellUtil.getFamilyArray(kv)));
|
||||
|
@ -3814,7 +3814,7 @@ public class TestFromClientSide {
|
|||
scan.addColumn(CONTENTS_FAMILY, null);
|
||||
ResultScanner scanner = table.getScanner(scan);
|
||||
for (Result r : scanner) {
|
||||
for(Cell key : r.raw()) {
|
||||
for(Cell key : r.rawCells()) {
|
||||
System.out.println(Bytes.toString(r.getRow()) + ": " + key.toString());
|
||||
}
|
||||
}
|
||||
|
@ -4016,7 +4016,7 @@ public class TestFromClientSide {
|
|||
int index = 0;
|
||||
Result r = null;
|
||||
while ((r = s.next()) != null) {
|
||||
for(Cell key : r.raw()) {
|
||||
for(Cell key : r.rawCells()) {
|
||||
times[index++] = key.getTimestamp();
|
||||
}
|
||||
}
|
||||
|
@ -4050,7 +4050,7 @@ public class TestFromClientSide {
|
|||
int index = 0;
|
||||
Result r = null;
|
||||
while ((r = s.next()) != null) {
|
||||
for(Cell key : r.raw()) {
|
||||
for(Cell key : r.rawCells()) {
|
||||
times[index++] = key.getTimestamp();
|
||||
}
|
||||
}
|
||||
|
@ -4177,7 +4177,7 @@ public class TestFromClientSide {
|
|||
for (Result r : s) {
|
||||
put = new Put(r.getRow());
|
||||
put.setDurability(Durability.SKIP_WAL);
|
||||
for (Cell kv : r.raw()) {
|
||||
for (Cell kv : r.rawCells()) {
|
||||
put.add(kv);
|
||||
}
|
||||
b.put(put);
|
||||
|
@ -4526,7 +4526,7 @@ public class TestFromClientSide {
|
|||
|
||||
// Verify expected results
|
||||
Result r = ht.get(new Get(ROW));
|
||||
Cell [] kvs = r.raw();
|
||||
Cell [] kvs = r.rawCells();
|
||||
assertEquals(5, kvs.length);
|
||||
assertIncrementKey(kvs[0], ROW, FAMILY, QUALIFIERS[0], 1);
|
||||
assertIncrementKey(kvs[1], ROW, FAMILY, QUALIFIERS[1], 3);
|
||||
|
@ -4542,7 +4542,7 @@ public class TestFromClientSide {
|
|||
ht.increment(inc);
|
||||
// Verify
|
||||
r = ht.get(new Get(ROWS[0]));
|
||||
kvs = r.raw();
|
||||
kvs = r.rawCells();
|
||||
assertEquals(QUALIFIERS.length, kvs.length);
|
||||
for (int i=0;i<QUALIFIERS.length;i++) {
|
||||
assertIncrementKey(kvs[i], ROWS[0], FAMILY, QUALIFIERS[i], i+1);
|
||||
|
@ -4556,7 +4556,7 @@ public class TestFromClientSide {
|
|||
ht.increment(inc);
|
||||
// Verify
|
||||
r = ht.get(new Get(ROWS[0]));
|
||||
kvs = r.raw();
|
||||
kvs = r.rawCells();
|
||||
assertEquals(QUALIFIERS.length, kvs.length);
|
||||
for (int i=0;i<QUALIFIERS.length;i++) {
|
||||
assertIncrementKey(kvs[i], ROWS[0], FAMILY, QUALIFIERS[i], 2*(i+1));
|
||||
|
@ -5199,7 +5199,7 @@ public class TestFromClientSide {
|
|||
ResultScanner scanner = table.getScanner(s);
|
||||
int count = 0;
|
||||
for (Result r : scanner) {
|
||||
assertEquals("Found an unexpected number of results for the row!", versions, r.list().size());
|
||||
assertEquals("Found an unexpected number of results for the row!", versions, r.listCells().size());
|
||||
count++;
|
||||
}
|
||||
assertEquals("Found more than a single row when raw scanning the table with a single row!", 1,
|
||||
|
@ -5213,7 +5213,7 @@ public class TestFromClientSide {
|
|||
scanner = table.getScanner(s);
|
||||
count = 0;
|
||||
for (Result r : scanner) {
|
||||
assertEquals("Found an unexpected number of results for the row!", versions, r.list().size());
|
||||
assertEquals("Found an unexpected number of results for the row!", versions, r.listCells().size());
|
||||
count++;
|
||||
}
|
||||
assertEquals("Found more than a single row when raw scanning the table with a single row!", 1,
|
||||
|
@ -5227,7 +5227,7 @@ public class TestFromClientSide {
|
|||
scanner = table.getScanner(s);
|
||||
count = 0;
|
||||
for (Result r : scanner) {
|
||||
assertEquals("Found an unexpected number of results for the row!", versions, r.list().size());
|
||||
assertEquals("Found an unexpected number of results for the row!", versions, r.listCells().size());
|
||||
count++;
|
||||
}
|
||||
assertEquals("Found more than a single row when raw scanning the table with a single row!", 1,
|
||||
|
|
|
@ -86,7 +86,7 @@ public class TestFromClientSideNoCodec {
|
|||
ResultScanner scanner = ht.getScanner(new Scan());
|
||||
int count = 0;
|
||||
while ((r = scanner.next()) != null) {
|
||||
assertTrue(r.list().size() == 3);
|
||||
assertTrue(r.listCells().size() == 3);
|
||||
count++;
|
||||
}
|
||||
assertTrue(count == 1);
|
||||
|
|
|
@ -184,8 +184,8 @@ public class TestMultiParallel {
|
|||
Assert.assertEquals(singleRes.size(), multiRes.length);
|
||||
for (int i = 0; i < singleRes.size(); i++) {
|
||||
Assert.assertTrue(singleRes.get(i).containsColumn(BYTES_FAMILY, QUALIFIER));
|
||||
Cell[] singleKvs = singleRes.get(i).raw();
|
||||
Cell[] multiKvs = multiRes[i].raw();
|
||||
Cell[] singleKvs = singleRes.get(i).rawCells();
|
||||
Cell[] multiKvs = multiRes[i].rawCells();
|
||||
for (int j = 0; j < singleKvs.length; j++) {
|
||||
Assert.assertEquals(singleKvs[j], multiKvs[j]);
|
||||
Assert.assertEquals(0, Bytes.compareTo(CellUtil.getValueArray(singleKvs[j]),
|
||||
|
@ -587,7 +587,7 @@ public class TestMultiParallel {
|
|||
Result result = (Result)r1;
|
||||
Assert.assertTrue(result != null);
|
||||
Assert.assertTrue(result.getRow() == null);
|
||||
Assert.assertEquals(0, result.raw().length);
|
||||
Assert.assertEquals(0, result.rawCells().length);
|
||||
}
|
||||
|
||||
private void validateSizeAndEmpty(Object[] results, int expectedSize) {
|
||||
|
|
|
@ -107,11 +107,11 @@ public class TestMultipleTimestamps {
|
|||
|
||||
Cell [] kvs;
|
||||
|
||||
kvs = scanner.next().raw();
|
||||
kvs = scanner.next().rawCells();
|
||||
assertEquals(2, kvs.length);
|
||||
checkOneCell(kvs[0], FAMILY, 3, 3, 4);
|
||||
checkOneCell(kvs[1], FAMILY, 3, 3, 3);
|
||||
kvs = scanner.next().raw();
|
||||
kvs = scanner.next().rawCells();
|
||||
assertEquals(2, kvs.length);
|
||||
checkOneCell(kvs[0], FAMILY, 5, 3, 4);
|
||||
checkOneCell(kvs[1], FAMILY, 5, 3, 3);
|
||||
|
@ -149,10 +149,10 @@ public class TestMultipleTimestamps {
|
|||
|
||||
Cell[] kvs;
|
||||
|
||||
kvs = scanner.next().raw();
|
||||
kvs = scanner.next().rawCells();
|
||||
assertEquals(1, kvs.length);
|
||||
checkOneCell(kvs[0], FAMILY, 3, 3, 3);
|
||||
kvs = scanner.next().raw();
|
||||
kvs = scanner.next().rawCells();
|
||||
assertEquals(1, kvs.length);
|
||||
checkOneCell(kvs[0], FAMILY, 5, 3, 3);
|
||||
|
||||
|
@ -198,13 +198,13 @@ public class TestMultipleTimestamps {
|
|||
|
||||
// This looks like wrong answer. Should be 2. Even then we are returning wrong result,
|
||||
// timestamps that are 3 whereas should be 2 since min is inclusive.
|
||||
kvs = scanner.next().raw();
|
||||
kvs = scanner.next().rawCells();
|
||||
assertEquals(4, kvs.length);
|
||||
checkOneCell(kvs[0], FAMILY, 5, 3, 3);
|
||||
checkOneCell(kvs[1], FAMILY, 5, 3, 2);
|
||||
checkOneCell(kvs[2], FAMILY, 5, 5, 3);
|
||||
checkOneCell(kvs[3], FAMILY, 5, 5, 2);
|
||||
kvs = scanner.next().raw();
|
||||
kvs = scanner.next().rawCells();
|
||||
assertEquals(4, kvs.length);
|
||||
checkOneCell(kvs[0], FAMILY, 7, 3, 3);
|
||||
checkOneCell(kvs[1], FAMILY, 7, 3, 2);
|
||||
|
@ -254,20 +254,20 @@ public class TestMultipleTimestamps {
|
|||
|
||||
Cell[] kvs;
|
||||
|
||||
kvs = scanner.next().raw();
|
||||
kvs = scanner.next().rawCells();
|
||||
assertEquals(2, kvs.length);
|
||||
checkOneCell(kvs[0], FAMILY, 3, 3, 4);
|
||||
checkOneCell(kvs[1], FAMILY, 3, 5, 2);
|
||||
|
||||
kvs = scanner.next().raw();
|
||||
kvs = scanner.next().rawCells();
|
||||
assertEquals(1, kvs.length);
|
||||
checkOneCell(kvs[0], FAMILY, 5, 3, 4);
|
||||
|
||||
kvs = scanner.next().raw();
|
||||
kvs = scanner.next().rawCells();
|
||||
assertEquals(1, kvs.length);
|
||||
checkOneCell(kvs[0], FAMILY, 6, 3, 4);
|
||||
|
||||
kvs = scanner.next().raw();
|
||||
kvs = scanner.next().rawCells();
|
||||
assertEquals(1, kvs.length);
|
||||
checkOneCell(kvs[0], FAMILY, 7, 3, 4);
|
||||
|
||||
|
@ -439,7 +439,7 @@ public class TestMultipleTimestamps {
|
|||
get.setTimeRange(Collections.min(versions), Collections.max(versions)+1);
|
||||
Result result = ht.get(get);
|
||||
|
||||
return result.raw();
|
||||
return result.rawCells();
|
||||
}
|
||||
|
||||
private ResultScanner scan(HTable ht, byte[] cf,
|
||||
|
|
|
@ -320,7 +320,7 @@ public class TestScannersFromClientSide {
|
|||
ResultScanner scanner = ht.getScanner(scan);
|
||||
kvListScan = new ArrayList<Cell>();
|
||||
while ((result = scanner.next()) != null) {
|
||||
for (Cell kv : result.list()) {
|
||||
for (Cell kv : result.listCells()) {
|
||||
kvListScan.add(kv);
|
||||
}
|
||||
}
|
||||
|
@ -434,7 +434,7 @@ public class TestScannersFromClientSide {
|
|||
return;
|
||||
|
||||
int i = 0;
|
||||
for (Cell kv : result.raw()) {
|
||||
for (Cell kv : result.rawCells()) {
|
||||
if (i >= expKvList.size()) {
|
||||
break; // we will check the size later
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ public class TestTimestampsFilter {
|
|||
Arrays.asList(6L, 106L, 306L));
|
||||
assertEquals("# of rows returned from scan", 5, results.length);
|
||||
for (int rowIdx = 0; rowIdx < 5; rowIdx++) {
|
||||
kvs = results[rowIdx].raw();
|
||||
kvs = results[rowIdx].rawCells();
|
||||
// each row should have 5 columns.
|
||||
// And we have requested 3 versions for each.
|
||||
assertEquals("Number of KeyValues in result for row:" + rowIdx,
|
||||
|
@ -196,15 +196,15 @@ public class TestTimestampsFilter {
|
|||
g.addColumn(FAMILY, Bytes.toBytes("column4"));
|
||||
|
||||
Result result = ht.get(g);
|
||||
for (Cell kv : result.list()) {
|
||||
for (Cell kv : result.listCells()) {
|
||||
System.out.println("found row " + Bytes.toString(CellUtil.getRowArray(kv)) +
|
||||
", column " + Bytes.toString(CellUtil.getQualifierArray(kv)) + ", value "
|
||||
+ Bytes.toString(CellUtil.getValueArray(kv)));
|
||||
}
|
||||
|
||||
assertEquals(result.list().size(), 2);
|
||||
assertTrue(CellUtil.matchingValue(result.list().get(0), Bytes.toBytes("value2-3")));
|
||||
assertTrue(CellUtil.matchingValue(result.list().get(1), Bytes.toBytes("value4-3")));
|
||||
assertEquals(result.listCells().size(), 2);
|
||||
assertTrue(CellUtil.matchingValue(result.listCells().get(0), Bytes.toBytes("value2-3")));
|
||||
assertTrue(CellUtil.matchingValue(result.listCells().get(1), Bytes.toBytes("value4-3")));
|
||||
|
||||
ht.close();
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ public class TestTimestampsFilter {
|
|||
get.setMaxVersions();
|
||||
Result result = ht.get(get);
|
||||
|
||||
return result.raw();
|
||||
return result.rawCells();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -123,7 +123,7 @@ public class TestOpenTableInCoprocessor {
|
|||
ResultScanner results = table.getScanner(scan);
|
||||
int count = 0;
|
||||
for (Result res : results) {
|
||||
count += res.list().size();
|
||||
count += res.listCells().size();
|
||||
System.out.println(count + ") " + res);
|
||||
}
|
||||
results.close();
|
||||
|
|
|
@ -176,7 +176,7 @@ public class TestRegionObserverScannerOpenHook {
|
|||
Result r = region.get(get);
|
||||
assertNull(
|
||||
"Got an unexpected number of rows - no data should be returned with the NoDataFromScan coprocessor. Found: "
|
||||
+ r, r.list());
|
||||
+ r, r.listCells());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -201,7 +201,7 @@ public class TestRegionObserverScannerOpenHook {
|
|||
Result r = region.get(get);
|
||||
assertNull(
|
||||
"Got an unexpected number of rows - no data should be returned with the NoDataFromScan coprocessor. Found: "
|
||||
+ r, r.list());
|
||||
+ r, r.listCells());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -262,13 +262,13 @@ public class TestRegionObserverScannerOpenHook {
|
|||
Result r = table.get(get);
|
||||
assertNull(
|
||||
"Got an unexpected number of rows - no data should be returned with the NoDataFromScan coprocessor. Found: "
|
||||
+ r, r.list());
|
||||
+ r, r.listCells());
|
||||
|
||||
get = new Get(Bytes.toBytes("anotherrow"));
|
||||
r = table.get(get);
|
||||
assertNull(
|
||||
"Got an unexpected number of rows - no data should be returned with the NoDataFromScan coprocessor Found: "
|
||||
+ r, r.list());
|
||||
+ r, r.listCells());
|
||||
|
||||
table.close();
|
||||
UTIL.shutdownMiniCluster();
|
||||
|
|
|
@ -166,7 +166,7 @@ public class TestRowProcessorEndpoint {
|
|||
Set<String> expected =
|
||||
new HashSet<String>(Arrays.asList(new String[]{"d", "e", "f", "g"}));
|
||||
Get get = new Get(ROW);
|
||||
LOG.debug("row keyvalues:" + stringifyKvs(table.get(get).list()));
|
||||
LOG.debug("row keyvalues:" + stringifyKvs(table.get(get).listCells()));
|
||||
assertEquals(expected, result);
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ public class TestRowProcessorEndpoint {
|
|||
int numThreads = 1000;
|
||||
concurrentExec(new IncrementRunner(), numThreads);
|
||||
Get get = new Get(ROW);
|
||||
LOG.debug("row keyvalues:" + stringifyKvs(table.get(get).list()));
|
||||
LOG.debug("row keyvalues:" + stringifyKvs(table.get(get).listCells()));
|
||||
int finalCounter = incrementCounter(table);
|
||||
assertEquals(numThreads + 1, finalCounter);
|
||||
assertEquals(0, failures.get());
|
||||
|
@ -238,11 +238,11 @@ public class TestRowProcessorEndpoint {
|
|||
int numThreads = 1000;
|
||||
concurrentExec(new SwapRowsRunner(), numThreads);
|
||||
LOG.debug("row keyvalues:" +
|
||||
stringifyKvs(table.get(new Get(ROW)).list()));
|
||||
stringifyKvs(table.get(new Get(ROW)).listCells()));
|
||||
LOG.debug("row2 keyvalues:" +
|
||||
stringifyKvs(table.get(new Get(ROW2)).list()));
|
||||
assertEquals(rowSize, table.get(new Get(ROW)).list().size());
|
||||
assertEquals(row2Size, table.get(new Get(ROW2)).list().size());
|
||||
stringifyKvs(table.get(new Get(ROW2)).listCells()));
|
||||
assertEquals(rowSize, table.get(new Get(ROW)).listCells().size());
|
||||
assertEquals(row2Size, table.get(new Get(ROW2)).listCells().size());
|
||||
assertEquals(0, failures.get());
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ public class TestColumnRangeFilter {
|
|||
|
||||
Result result;
|
||||
while ((result = scanner.next()) != null) {
|
||||
for (Cell kv : result.list()) {
|
||||
for (Cell kv : result.listCells()) {
|
||||
results.add(kv);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class TestFilterWithScanLimits {
|
|||
// row2 => <f1:c5, 2_c5>
|
||||
|
||||
for (Result result : scanner) {
|
||||
for (Cell kv : result.list()) {
|
||||
for (Cell kv : result.listCells()) {
|
||||
kv_number++;
|
||||
LOG.debug(kv_number + ". kv: " + kv);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public class TestFilterWrapper {
|
|||
// row2 (c1-c4) and row3(c1-c4) are returned
|
||||
for (Result result : scanner) {
|
||||
row_number++;
|
||||
for (Cell kv : result.list()) {
|
||||
for (Cell kv : result.listCells()) {
|
||||
LOG.debug(kv_number + ". kv: " + kv);
|
||||
kv_number++;
|
||||
assertEquals("Returned row is not correct", new String(CellUtil.getRowArray(kv)),
|
||||
|
|
|
@ -163,7 +163,7 @@ public class TestFuzzyRowAndColumnRangeFilter {
|
|||
Result result;
|
||||
long timeBeforeScan = System.currentTimeMillis();
|
||||
while ((result = scanner.next()) != null) {
|
||||
for (Cell kv : result.list()) {
|
||||
for (Cell kv : result.listCells()) {
|
||||
LOG.info("Got rk: " + Bytes.toStringBinary(CellUtil.getRowArray(kv)) + " cq: "
|
||||
+ Bytes.toStringBinary(CellUtil.getQualifierArray(kv)));
|
||||
results.add(kv);
|
||||
|
|
|
@ -213,7 +213,7 @@ public class TestTableMapReduce {
|
|||
byte[] firstValue = null;
|
||||
byte[] secondValue = null;
|
||||
int count = 0;
|
||||
for(Cell kv : r.list()) {
|
||||
for(Cell kv : r.listCells()) {
|
||||
if (count == 0) {
|
||||
firstValue = CellUtil.getValueArray(kv);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public class TestCopyTable {
|
|||
Get g = new Get(Bytes.toBytes("row" + i));
|
||||
Result r = t2.get(g);
|
||||
assertEquals(1, r.size());
|
||||
assertTrue(CellUtil.matchingQualifier(r.raw()[0], COLUMN1));
|
||||
assertTrue(CellUtil.matchingQualifier(r.rawCells()[0], COLUMN1));
|
||||
}
|
||||
|
||||
t1.close();
|
||||
|
@ -150,7 +150,7 @@ public class TestCopyTable {
|
|||
Get g = new Get(ROW1);
|
||||
Result r = t2.get(g);
|
||||
assertEquals(1, r.size());
|
||||
assertTrue(CellUtil.matchingQualifier(r.raw()[0], COLUMN1));
|
||||
assertTrue(CellUtil.matchingQualifier(r.rawCells()[0], COLUMN1));
|
||||
|
||||
g = new Get(ROW0);
|
||||
r = t2.get(g);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class TestGroupingTableMapper {
|
|||
.toBytes("value1")));
|
||||
keyValue.add(new KeyValue(row, Bytes.toBytes("family1"), Bytes.toBytes("clm"), Bytes
|
||||
.toBytes("value2")));
|
||||
when(result.list()).thenReturn(keyValue);
|
||||
when(result.listCells()).thenReturn(keyValue);
|
||||
mapper.map(null, result, context);
|
||||
// template data
|
||||
byte[][] data = { Bytes.toBytes("value1"), Bytes.toBytes("value2") };
|
||||
|
|
|
@ -427,9 +427,9 @@ public class TestHFileOutputFormat {
|
|||
Scan scan = new Scan();
|
||||
ResultScanner results = table.getScanner(scan);
|
||||
for (Result res : results) {
|
||||
assertEquals(FAMILIES.length, res.raw().length);
|
||||
Cell first = res.raw()[0];
|
||||
for (Cell kv : res.raw()) {
|
||||
assertEquals(FAMILIES.length, res.rawCells().length);
|
||||
Cell first = res.rawCells()[0];
|
||||
for (Cell kv : res.rawCells()) {
|
||||
assertTrue(CellUtil.matchingRow(first, kv));
|
||||
assertTrue(Bytes.equals(CellUtil.getValueArray(first), CellUtil.getValueArray(kv)));
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ public class TestImportExport {
|
|||
s.setRaw(true);
|
||||
ResultScanner scanner = t.getScanner(s);
|
||||
Result r = scanner.next();
|
||||
Cell[] res = r.raw();
|
||||
Cell[] res = r.rawCells();
|
||||
assertTrue(CellUtil.isDeleteFamily(res[0]));
|
||||
assertEquals(now+4, res[1].getTimestamp());
|
||||
assertEquals(now+3, res[2].getTimestamp());
|
||||
|
@ -467,7 +467,7 @@ public class TestImportExport {
|
|||
Bytes.toBytes("value")),
|
||||
new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("family"), Bytes.toBytes("qualifier"),
|
||||
Bytes.toBytes("value1")) };
|
||||
when(value.raw()).thenReturn(keys);
|
||||
when(value.rawCells()).thenReturn(keys);
|
||||
importer.map(new ImmutableBytesWritable(Bytes.toBytes("Key")), value, ctx);
|
||||
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ public class TestImportTsv implements Configurable {
|
|||
ResultScanner resScanner = table.getScanner(scan);
|
||||
for (Result res : resScanner) {
|
||||
assertTrue(res.size() == 2);
|
||||
List<Cell> kvs = res.list();
|
||||
List<Cell> kvs = res.listCells();
|
||||
assertTrue(CellUtil.matchingRow(kvs.get(0), Bytes.toBytes("KEY")));
|
||||
assertTrue(CellUtil.matchingRow(kvs.get(1), Bytes.toBytes("KEY")));
|
||||
assertTrue(CellUtil.matchingValue(kvs.get(0), Bytes.toBytes("VALUE" + valueMultiplier)));
|
||||
|
|
|
@ -213,7 +213,7 @@ public class TestMultithreadedTableMapper {
|
|||
byte[] firstValue = null;
|
||||
byte[] secondValue = null;
|
||||
int count = 0;
|
||||
for(Cell kv : r.list()) {
|
||||
for(Cell kv : r.listCells()) {
|
||||
if (count == 0) {
|
||||
firstValue = CellUtil.getValueArray(kv);
|
||||
}else if (count == 1) {
|
||||
|
|
|
@ -226,7 +226,7 @@ public class TestTableMapReduce {
|
|||
byte[] firstValue = null;
|
||||
byte[] secondValue = null;
|
||||
int count = 0;
|
||||
for(Cell kv : r.list()) {
|
||||
for(Cell kv : r.listCells()) {
|
||||
if (count == 0) {
|
||||
firstValue = CellUtil.getValueArray(kv);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ public class TestTimeRangeMapRed {
|
|||
Context context)
|
||||
throws IOException {
|
||||
List<Long> tsList = new ArrayList<Long>();
|
||||
for (Cell kv : result.list()) {
|
||||
for (Cell kv : result.listCells()) {
|
||||
tsList.add(kv.getTimestamp());
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ public class TestTimeRangeMapRed {
|
|||
scan.setMaxVersions(1);
|
||||
ResultScanner scanner = table.getScanner(scan);
|
||||
for (Result r: scanner) {
|
||||
for (Cell kv : r.list()) {
|
||||
for (Cell kv : r.listCells()) {
|
||||
log.debug(Bytes.toString(r.getRow()) + "\t" + Bytes.toString(CellUtil.getFamilyArray(kv))
|
||||
+ "\t" + Bytes.toString(CellUtil.getQualifierArray(kv))
|
||||
+ "\t" + kv.getTimestamp() + "\t" + Bytes.toBoolean(CellUtil.getValueArray(kv)));
|
||||
|
|
|
@ -124,7 +124,7 @@ public class TestWALPlayer {
|
|||
Get g = new Get(ROW);
|
||||
Result r = t2.get(g);
|
||||
assertEquals(1, r.size());
|
||||
assertTrue(CellUtil.matchingQualifier(r.raw()[0], COLUMN2));
|
||||
assertTrue(CellUtil.matchingQualifier(r.rawCells()[0], COLUMN2));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -174,7 +174,7 @@ public class TestAtomicOperation {
|
|||
Result result = region.get(get);
|
||||
assertEquals(1, result.size());
|
||||
|
||||
Cell kv = result.raw()[0];
|
||||
Cell kv = result.rawCells()[0];
|
||||
long r = Bytes.toLong(CellUtil.getValueArray(kv));
|
||||
assertEquals(amount, r);
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ public class TestBlocksRead extends HBaseTestCase {
|
|||
get.addColumn(cf, Bytes.toBytes(column));
|
||||
}
|
||||
|
||||
kvs = region.get(get).raw();
|
||||
kvs = region.get(get).rawCells();
|
||||
long blocksEnd = getBlkAccessCount(cf);
|
||||
if (expBlocks[i] != -1) {
|
||||
assertEquals("Blocks Read Check for Bloom: " + bloomType, expBlocks[i],
|
||||
|
|
|
@ -1066,7 +1066,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
|
||||
Get get = new Get(row1);
|
||||
get.addColumn(fam2, qf1);
|
||||
Cell [] actual = region.get(get).raw();
|
||||
Cell [] actual = region.get(get).rawCells();
|
||||
|
||||
Cell [] expected = {kv};
|
||||
|
||||
|
@ -1386,7 +1386,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
Get get = new Get(row).addColumn(fam, qual);
|
||||
Result result = region.get(get);
|
||||
assertEquals(1, result.size());
|
||||
Cell kv = result.raw()[0];
|
||||
Cell kv = result.rawCells()[0];
|
||||
LOG.info("Got: " + kv);
|
||||
assertTrue("LATEST_TIMESTAMP was not replaced with real timestamp",
|
||||
kv.getTimestamp() != HConstants.LATEST_TIMESTAMP);
|
||||
|
@ -1402,7 +1402,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
get = new Get(row).addColumn(fam, qual);
|
||||
result = region.get(get);
|
||||
assertEquals(1, result.size());
|
||||
kv = result.raw()[0];
|
||||
kv = result.rawCells()[0];
|
||||
LOG.info("Got: " + kv);
|
||||
assertTrue("LATEST_TIMESTAMP was not replaced with real timestamp",
|
||||
kv.getTimestamp() != HConstants.LATEST_TIMESTAMP);
|
||||
|
@ -1656,9 +1656,9 @@ public class TestHRegion extends HBaseTestCase {
|
|||
Result res = region.get(get);
|
||||
assertEquals(expected.length, res.size());
|
||||
for(int i=0; i<res.size(); i++){
|
||||
assertTrue(CellUtil.matchingRow(expected[i], res.raw()[i]));
|
||||
assertTrue(CellUtil.matchingFamily(expected[i], res.raw()[i]));
|
||||
assertTrue(CellUtil.matchingQualifier(expected[i], res.raw()[i]));
|
||||
assertTrue(CellUtil.matchingRow(expected[i], res.rawCells()[i]));
|
||||
assertTrue(CellUtil.matchingFamily(expected[i], res.rawCells()[i]));
|
||||
assertTrue(CellUtil.matchingQualifier(expected[i], res.rawCells()[i]));
|
||||
}
|
||||
|
||||
// Test using a filter on a Get
|
||||
|
@ -2366,7 +2366,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
Result result = region.get(get);
|
||||
assertEquals(1, result.size());
|
||||
|
||||
Cell kv = result.raw()[0];
|
||||
Cell kv = result.rawCells()[0];
|
||||
long r = Bytes.toLong(CellUtil.getValueArray(kv));
|
||||
assertEquals(amount, r);
|
||||
}
|
||||
|
@ -2381,7 +2381,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
Result result = region.get(get);
|
||||
assertEquals(1, result.size());
|
||||
|
||||
Cell kv = result.raw()[0];
|
||||
Cell kv = result.rawCells()[0];
|
||||
int r = Bytes.toInt(CellUtil.getValueArray(kv));
|
||||
assertEquals(amount, r);
|
||||
}
|
||||
|
@ -3117,7 +3117,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
// TODO this was removed, now what dangit?!
|
||||
// search looking for the qualifier in question?
|
||||
long timestamp = 0;
|
||||
for (Cell kv : result.raw()) {
|
||||
for (Cell kv : result.rawCells()) {
|
||||
if (CellUtil.matchingFamily(kv, families[0])
|
||||
&& CellUtil.matchingQualifier(kv, qualifiers[0])) {
|
||||
timestamp = kv.getTimestamp();
|
||||
|
@ -3127,7 +3127,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
prevTimestamp = timestamp;
|
||||
Cell previousKV = null;
|
||||
|
||||
for (Cell kv : result.raw()) {
|
||||
for (Cell kv : result.rawCells()) {
|
||||
byte[] thisValue = CellUtil.getValueArray(kv);
|
||||
if (previousKV != null) {
|
||||
if (Bytes.compareTo(CellUtil.getValueArray(previousKV), thisValue) != 0) {
|
||||
|
@ -3324,7 +3324,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
//Get rows
|
||||
Get get = new Get(row);
|
||||
get.setMaxVersions();
|
||||
Cell[] kvs = region.get(get).raw();
|
||||
Cell[] kvs = region.get(get).rawCells();
|
||||
|
||||
//Check if rows are correct
|
||||
assertEquals(4, kvs.length);
|
||||
|
@ -3375,7 +3375,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
Get get = new Get(row);
|
||||
get.addColumn(familyName, col);
|
||||
|
||||
Cell[] keyValues = region.get(get).raw();
|
||||
Cell[] keyValues = region.get(get).rawCells();
|
||||
assertTrue(keyValues.length == 0);
|
||||
} finally {
|
||||
HRegion.closeHRegion(this.region);
|
||||
|
@ -3899,7 +3899,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
get.addColumn(family, qf);
|
||||
}
|
||||
Result result = newReg.get(get);
|
||||
Cell [] raw = result.raw();
|
||||
Cell [] raw = result.rawCells();
|
||||
assertEquals(families.length, result.size());
|
||||
for(int j=0; j<families.length; j++) {
|
||||
assertTrue(CellUtil.matchingRow(raw[j], row));
|
||||
|
@ -3913,7 +3913,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
throws IOException {
|
||||
// Now I have k, get values out and assert they are as expected.
|
||||
Get get = new Get(k).addFamily(family).setMaxVersions();
|
||||
Cell [] results = r.get(get).raw();
|
||||
Cell [] results = r.get(get).rawCells();
|
||||
for (int j = 0; j < results.length; j++) {
|
||||
byte [] tmp = CellUtil.getValueArray(results[j]);
|
||||
// Row should be equal to value every time.
|
||||
|
|
|
@ -140,7 +140,7 @@ public class TestParallelPut extends HBaseTestCase {
|
|||
Result result = region.get(get);
|
||||
assertEquals(1, result.size());
|
||||
|
||||
Cell kv = result.raw()[0];
|
||||
Cell kv = result.rawCells()[0];
|
||||
byte[] r = CellUtil.getValueArray(kv);
|
||||
assertTrue(Bytes.compareTo(r, value) == 0);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class TestResettingCounters {
|
|||
// increment all qualifiers, should have value=6 for all
|
||||
Result result = region.increment(all);
|
||||
assertEquals(numQualifiers, result.size());
|
||||
Cell [] kvs = result.raw();
|
||||
Cell [] kvs = result.rawCells();
|
||||
for (int i=0;i<kvs.length;i++) {
|
||||
System.out.println(kvs[i].toString());
|
||||
assertTrue(CellUtil.matchingQualifier(kvs[i], qualifiers[i]));
|
||||
|
|
|
@ -140,9 +140,9 @@ public class TestReplicationSmallTests extends TestReplicationBase {
|
|||
LOG.info("Rows not available");
|
||||
Thread.sleep(SLEEP_TIME);
|
||||
} else {
|
||||
assertArrayEquals(CellUtil.getValueArray(res.raw()[0]), v3);
|
||||
assertArrayEquals(CellUtil.getValueArray(res.raw()[1]), v2);
|
||||
assertArrayEquals(CellUtil.getValueArray(res.raw()[2]), v1);
|
||||
assertArrayEquals(CellUtil.getValueArray(res.rawCells()[0]), v3);
|
||||
assertArrayEquals(CellUtil.getValueArray(res.rawCells()[1]), v2);
|
||||
assertArrayEquals(CellUtil.getValueArray(res.rawCells()[2]), v1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -162,8 +162,8 @@ public class TestReplicationSmallTests extends TestReplicationBase {
|
|||
LOG.info("Version not deleted");
|
||||
Thread.sleep(SLEEP_TIME);
|
||||
} else {
|
||||
assertArrayEquals(CellUtil.getValueArray(res.raw()[0]), v3);
|
||||
assertArrayEquals(CellUtil.getValueArray(res.raw()[1]), v2);
|
||||
assertArrayEquals(CellUtil.getValueArray(res.rawCells()[0]), v3);
|
||||
assertArrayEquals(CellUtil.getValueArray(res.rawCells()[1]), v2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ public class TestReplicationSmallTests extends TestReplicationBase {
|
|||
Put put = null;
|
||||
for (Result result : rs) {
|
||||
put = new Put(result.getRow());
|
||||
Cell firstVal = result.raw()[0];
|
||||
Cell firstVal = result.rawCells()[0];
|
||||
put.add(CellUtil.getFamilyArray(firstVal),
|
||||
CellUtil.getQualifierArray(firstVal), Bytes.toBytes("diff data"));
|
||||
htable2.put(put);
|
||||
|
|
|
@ -209,7 +209,7 @@ public class TestRemoteTable {
|
|||
get.setMaxVersions(2);
|
||||
result = remoteTable.get(get);
|
||||
int count = 0;
|
||||
for (Cell kv: result.list()) {
|
||||
for (Cell kv: result.listCells()) {
|
||||
if (CellUtil.matchingFamily(kv, COLUMN_1) && TS_1 == kv.getTimestamp()) {
|
||||
assertTrue(CellUtil.matchingValue(kv, VALUE_1)); // @TS_1
|
||||
count++;
|
||||
|
|
|
@ -243,7 +243,7 @@ public class TestMergeTool extends HBaseTestCase {
|
|||
get.addFamily(FAMILY);
|
||||
Result result = merged.get(get);
|
||||
assertEquals(1, result.size());
|
||||
byte [] bytes = CellUtil.getValueArray(result.raw()[0]);
|
||||
byte [] bytes = CellUtil.getValueArray(result.rawCells()[0]);
|
||||
assertNotNull(Bytes.toStringBinary(rows[i][j]), bytes);
|
||||
assertTrue(Bytes.equals(bytes, rows[i][j]));
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ public class TestMergeTool extends HBaseTestCase {
|
|||
Get get = new Get(rows[i][j]);
|
||||
get.addFamily(FAMILY);
|
||||
Result result = regions[i].get(get);
|
||||
byte [] bytes = CellUtil.getValueArray(result.raw()[0]);
|
||||
byte [] bytes = CellUtil.getValueArray(result.rawCells()[0]);
|
||||
assertNotNull(bytes);
|
||||
assertTrue(Bytes.equals(bytes, rows[i][j]));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue