mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-25 20:55:59 +10:00
[유치수] [NOBTS] add bytes to long[2]
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-commons/trunk@696 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -233,8 +233,6 @@ public class HBaseClient {
|
||||
HTableInterface htable = getHTable(tableName);
|
||||
|
||||
if (query.isSingleRow()) {
|
||||
System.out.println("Query single row");
|
||||
|
||||
Get get = new Get(startRow);
|
||||
|
||||
if (columns != null) {
|
||||
@@ -247,9 +245,7 @@ public class HBaseClient {
|
||||
List<Result> resultList = new ArrayList<Result>(1);
|
||||
resultList.add(result);
|
||||
resultIterator = resultList.iterator();
|
||||
|
||||
} else {
|
||||
System.out.println("Query multiple rows");
|
||||
Scan scan = new Scan();
|
||||
|
||||
if (startRow != null) {
|
||||
@@ -269,19 +265,10 @@ public class HBaseClient {
|
||||
|
||||
LOG.debug("Executing scanner: " + query);
|
||||
|
||||
System.out.println("executing scanner:" + query);
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
resultScanner = htable.getScanner(scan);
|
||||
|
||||
System.out.println("result scanner:" + resultScanner);
|
||||
|
||||
Iterator<Result> it = resultScanner.iterator();
|
||||
while (it.hasNext()) {
|
||||
System.out.println("R=" + it.next());
|
||||
}
|
||||
|
||||
LOG.trace("Time taken for scanner: " + (System.currentTimeMillis() - start));
|
||||
|
||||
resultIterator = resultScanner.iterator();
|
||||
|
||||
@@ -8,6 +8,29 @@ public class BytesUtils {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public static final long[] bytesToLongLong(byte[] b) {
|
||||
long[] result = new long[2];
|
||||
|
||||
result[0] = byteToLong(b, 0);
|
||||
result[1] = byteToLong(b, 8);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static final long byteToLong(byte[] b, int offset) {
|
||||
if (b.length < offset + 8) {
|
||||
throw new IllegalArgumentException("Illegal bytes or offset.");
|
||||
}
|
||||
|
||||
long rv = 0;
|
||||
for (int index = offset; index < offset + 8; index++) {
|
||||
byte i = b[index];
|
||||
rv = (rv << 8) | (i < 0 ? 256 + i : i);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
private static void writeLong(long value, byte[] buf, int offset) {
|
||||
// for (int i = offset + 7; i > offset; i--) {
|
||||
// buf [i]= (byte) val;
|
||||
|
||||
Reference in New Issue
Block a user