Skip to content
Snippets Groups Projects
Commit 095e9679 authored by Connor McCoy's avatar Connor McCoy
Browse files

[hbase10] Modifications for HBase 2.0.0-SNAPSHOT

Remove deprecated methods:
Put.add -> Put.addColumn.
KeyValue -> Cell.
parent 7df83eaa
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,6 @@ import org.apache.hadoop.hbase.Cell; ...@@ -28,7 +28,6 @@ import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.BufferedMutator; import org.apache.hadoop.hbase.client.BufferedMutator;
import org.apache.hadoop.hbase.client.BufferedMutatorParams; import org.apache.hadoop.hbase.client.BufferedMutatorParams;
...@@ -250,7 +249,9 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB ...@@ -250,7 +249,9 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB
if (r.isEmpty()) { if (r.isEmpty()) {
return NoMatchingRecord; return NoMatchingRecord;
} }
for (Cell c : r.listCells()) {
while (r.advance()) {
final Cell c = r.current();
result.put(Bytes.toString(CellUtil.cloneQualifier(c)), result.put(Bytes.toString(CellUtil.cloneQualifier(c)),
new ByteArrayByteIterator(CellUtil.cloneValue(c))); new ByteArrayByteIterator(CellUtil.cloneValue(c)));
if (_debug) { if (_debug) {
...@@ -316,6 +317,7 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB ...@@ -316,6 +317,7 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB
{ {
//get row key //get row key
String key = Bytes.toString(rr.getRow()); String key = Bytes.toString(rr.getRow());
if (_debug) if (_debug)
{ {
System.out.println("Got scan result for key: "+key); System.out.println("Got scan result for key: "+key);
...@@ -323,11 +325,13 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB ...@@ -323,11 +325,13 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB
HashMap<String,ByteIterator> rowResult = new HashMap<String, ByteIterator>(); HashMap<String,ByteIterator> rowResult = new HashMap<String, ByteIterator>();
for (KeyValue kv : rr.raw()) { while (rr.advance()) {
final Cell cell = rr.current();
rowResult.put( rowResult.put(
Bytes.toString(kv.getQualifier()), Bytes.toString(CellUtil.cloneQualifier(cell)),
new ByteArrayByteIterator(kv.getValue())); new ByteArrayByteIterator(CellUtil.cloneValue(cell)));
} }
//add rowResult to result vector //add rowResult to result vector
result.add(rowResult); result.add(rowResult);
numResults++; numResults++;
...@@ -397,7 +401,7 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB ...@@ -397,7 +401,7 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB
System.out.println("Adding field/value " + entry.getKey() + "/"+ System.out.println("Adding field/value " + entry.getKey() + "/"+
Bytes.toStringBinary(value) + " to put request"); Bytes.toStringBinary(value) + " to put request");
} }
p.add(_columnFamilyBytes,Bytes.toBytes(entry.getKey()), value); p.addColumn(_columnFamilyBytes,Bytes.toBytes(entry.getKey()), value);
} }
try try
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment