HBASE-2753 Remove sorted() methods from Result now that Gets are Scans

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1003710 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan Rawson 2010-10-01 23:48:10 +00:00
parent d62b494cb5
commit aacffa11d0
2 changed files with 10 additions and 2 deletions

View File

@ -564,6 +564,7 @@ Release 0.21.0 - Unreleased
in transition
HBASE-3064 Long sleeping in HConnectionManager after thread is interrupted
(Bruno Dumon via Stack)
HBASE-2753 Remove sorted() methods from Result now that Gets are Scans
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -20,6 +20,7 @@
package org.apache.hadoop.hbase.client;
import com.google.common.collect.Ordering;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.SplitKeyValue;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
@ -149,12 +150,18 @@ public class Result implements Writable {
* @return sorted array of KeyValues
*/
public KeyValue[] sorted() {
if (isEmpty()) {
if (isEmpty()) { // used for side effect!
return null;
}
Arrays.sort(kvs, KeyValue.COMPARATOR);
if (!sorted) {
assert Ordering.from(KeyValue.COMPARATOR).isOrdered(Arrays.asList(kvs));
Arrays.sort(kvs, KeyValue.COMPARATOR);
sorted = true;
}
return kvs;
}
private boolean sorted = false;
/**
* Map of families to all versions of its qualifiers and values.