HBASE-1622 Make KeyValue implement the Comparable interface to make it work with Cascading -- reversed application

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@792028 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-07-08 04:16:51 +00:00
parent 6fed28f7c8
commit e59e923ecb
2 changed files with 5 additions and 19 deletions

View File

@ -450,8 +450,6 @@ Release 0.20.0 - Unreleased
HBASE-1620 Need to use special StoreScanner constructor for major compactions
(passed sf, no caching, etc) (Jon Gray via Stack)
HBASE-1624 Don't sort Puts if only one in list in HCM#processBatchOfRows
HBASE-1622 Make KeyValue implement the Comparable interface to make it work
with Cascading (Erik Holstad via Stack)
OPTIMIZATIONS
HBASE-1412 Change values for delete column and column family in KeyValue

View File

@ -30,7 +30,7 @@ import org.apache.hadoop.hbase.io.hfile.HFile;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.ClassSize;
import org.apache.hadoop.io.RawComparator;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.Writable;
/**
* An HBase Key/Value. Instances of this class are immutable. They are not
@ -53,7 +53,7 @@ import org.apache.hadoop.io.WritableComparable;
* <p>TODO: Group Key-only comparators and operations into a Key class, just
* for neatness sake, if can figure what to call it.
*/
public class KeyValue implements WritableComparable<KeyValue>, HeapSize {
public class KeyValue implements Writable, HeapSize {
static final Log LOG = LogFactory.getLog(KeyValue.class);
/**
@ -61,8 +61,7 @@ public class KeyValue implements WritableComparable<KeyValue>, HeapSize {
*/
public static final char COLUMN_FAMILY_DELIMITER = ':';
public static final byte[] COLUMN_FAMILY_DELIM_ARRAY =
new byte[]{COLUMN_FAMILY_DELIMITER};
public static final byte[] COLUMN_FAMILY_DELIM_ARRAY = new byte[]{COLUMN_FAMILY_DELIMITER};
/**
* Comparator for plain key/values; i.e. non-catalog table key/values.
@ -540,12 +539,8 @@ public class KeyValue implements WritableComparable<KeyValue>, HeapSize {
value, voffset, vlength);
}
/**
* Needed doing 'contains' on List. Only compares the key portion, not the
* value.
* @param other Object to compare ourselves to.
* @return True if equal to <code>other</code>
*/
// Needed doing 'contains' on List. Only compares the key portion, not the
// value.
public boolean equals(Object other) {
KeyValue kv = (KeyValue)other;
// Comparing bytes should be fine doing equals test. Shouldn't have to
@ -1799,7 +1794,6 @@ public class KeyValue implements WritableComparable<KeyValue>, HeapSize {
(2 * Bytes.SIZEOF_INT));
}
// WritableComparable
// Writable
public void readFields(final DataInput in) throws IOException {
this.length = in.readInt();
@ -1812,10 +1806,4 @@ public class KeyValue implements WritableComparable<KeyValue>, HeapSize {
out.writeInt(this.length);
out.write(this.bytes, this.offset, this.length);
}
// Comparable
public int compareTo(KeyValue that) {
return KEY_COMPARATOR.compare(this.bytes, this.offset, this.length,
that.getBuffer(), that.getOffset(), that.getLength());
}
}