Class Key
- All Implemented Interfaces:
Cloneable
,Comparable<Key>
,org.apache.hadoop.io.Writable
,org.apache.hadoop.io.WritableComparable<Key>
Keys are comparable and therefore have a sorted order defined by compareTo(Key)
.
-
Field Summary
Modifier and TypeFieldDescriptionprotected byte[]
protected byte[]
protected byte[]
protected boolean
protected byte[]
protected long
-
Constructor Summary
ConstructorDescriptionKey()
Creates a key with empty row, empty column family, empty column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false.Key
(byte[] row) Creates a key with the specified row, empty column family, empty column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false.Key
(byte[] row, byte[] cf) Creates a key with the specified row, the specified column family, empty column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false.Key
(byte[] row, byte[] cf, byte[] cq) Creates a key with the specified row, the specified column family, the specified column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false.Key
(byte[] row, byte[] cf, byte[] cq, byte[] cv) Creates a key with the specified row, the specified column family, the specified column qualifier, the specified column visibility, timestampLong.MAX_VALUE
, and delete marker false.Key
(byte[] row, byte[] colFamily, byte[] colQualifier, byte[] colVisibility, long timestamp) Creates a key.Key
(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted) Creates a key.Key
(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy) Creates a key.Key
(byte[] row, byte[] cf, byte[] cq, long ts) Creates a key with the specified row, the specified column family, the specified column qualifier, empty column visibility, the specified timestamp, and delete marker false.Key
(byte[] row, byte[] cf, byte[] cq, ColumnVisibility cv, long ts) Creates a key with the specified row, the specified column family, the specified column qualifier, the specified column visibility, the specified timestamp, and delete marker false.Key
(byte[] row, int rOff, int rLen, byte[] cf, int cfOff, int cfLen, byte[] cq, int cqOff, int cqLen, byte[] cv, int cvOff, int cvLen, long ts) Creates a key.Key
(byte[] row, long ts) Creates a key with the specified row, empty column family, empty column qualifier, empty column visibility, the specified timestamp, and delete marker false.Key
(CharSequence row) Converts CharSequence to Text and creates a Key usingKey(Text)
.Key
(CharSequence row, CharSequence cf) Converts CharSequence to Text and creates a Key usingKey(Text,Text)
.Key
(CharSequence row, CharSequence cf, CharSequence cq) Converts CharSequence to Text and creates a Key usingKey(Text,Text,Text)
.Key
(CharSequence row, CharSequence cf, CharSequence cq, long ts) Converts CharSequence to Text and creates a Key usingKey(Text,Text,Text,long)
.Key
(CharSequence row, CharSequence cf, CharSequence cq, CharSequence cv) Converts CharSequence to Text and creates a Key usingKey(Text,Text,Text,Text)
.Key
(CharSequence row, CharSequence cf, CharSequence cq, CharSequence cv, long ts) Converts CharSequence to Text and creates a Key usingKey(Text,Text,Text,Text,long)
.Key
(CharSequence row, CharSequence cf, CharSequence cq, ColumnVisibility cv, long ts) Converts CharSequence to Text and creates a Key usingKey(Text,Text,Text,ColumnVisibility,long)
.Creates a key with the same row, column family, column qualifier, column visibility, timestamp, and delete marker as the given key.Key
(org.apache.accumulo.core.dataImpl.thrift.TKey tkey) Creates a key from Thrift.Key
(org.apache.hadoop.io.Text row) Creates a key with the specified row, empty column family, empty column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false.Key
(org.apache.hadoop.io.Text row, long ts) Creates a key with the specified row, empty column family, empty column qualifier, empty column visibility, the specified timestamp, and delete marker false.Key
(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf) Creates a key with the specified row, the specified column family, empty column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false.Key
(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq) Creates a key with the specified row, the specified column family, the specified column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false.Key
(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq, long ts) Creates a key with the specified row, the specified column family, the specified column qualifier, empty column visibility, the specified timestamp, and delete marker false.Key
(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq, ColumnVisibility cv, long ts) Creates a key with the specified row, the specified column family, the specified column qualifier, the specified column visibility, the specified timestamp, and delete marker false.Key
(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq, org.apache.hadoop.io.Text cv) Creates a key with the specified row, the specified column family, the specified column qualifier, the specified column visibility, timestampLong.MAX_VALUE
, and delete marker false.Key
(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq, org.apache.hadoop.io.Text cv, long ts) Creates a key with the specified row, the specified column family, the specified column qualifier, the specified column visibility, the specified timestamp, and delete marker false. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringBuilder
appendPrintableString
(byte[] ba, int offset, int len, int maxLen, StringBuilder sb) Appends ASCII printable characters to a string, based on the given byte array, treating the bytes as ASCII characters.static KeyBuilder.RowStep
builder()
Create aKey
builder.static KeyBuilder.RowStep
builder
(boolean copyBytes) Create aKey
builder.clone()
int
compareColumnFamily
(org.apache.hadoop.io.Text cf) Compares this key's column family with another.int
compareColumnQualifier
(org.apache.hadoop.io.Text cq) Compares this key's column qualifier with another.int
compareRow
(org.apache.hadoop.io.Text r) Compares this key's row ID with another.int
int
compareTo
(Key other, PartialKey part) Compares elements of a key given by aPartialKey
.static List<org.apache.accumulo.core.dataImpl.thrift.TKeyValue>
Compresses a list of key/value pairs before sending them via thrift.static void
decompress
(List<org.apache.accumulo.core.dataImpl.thrift.TKeyValue> param) Decompresses a list of key/value pairs received from thrift.boolean
boolean
equals
(Key other, PartialKey part) Compares part of a key.followingKey
(PartialKey part) Returns a key that will sort immediately after this key.org.apache.hadoop.io.Text
Gets the column family as aText
object.org.apache.hadoop.io.Text
getColumnFamily
(org.apache.hadoop.io.Text cf) Writes the column family into the givenText
.Returns the column family as a byte sequence.org.apache.hadoop.io.Text
Gets the column qualifier as aText
object.org.apache.hadoop.io.Text
getColumnQualifier
(org.apache.hadoop.io.Text cq) Writes the column qualifier into the givenText
.Returns the column qualifier as a byte sequence.final org.apache.hadoop.io.Text
Gets the column visibility as aText
object.final org.apache.hadoop.io.Text
getColumnVisibility
(org.apache.hadoop.io.Text cv) Writes the column visibility into the givenText
.Returns the column visibility as a byte sequence.final ColumnVisibility
Gets the column visibility.int
Returns the sums of the lengths of the row, column family, column qualifier, and column visibility.org.apache.hadoop.io.Text
getRow()
Gets the row ID as aText
object.org.apache.hadoop.io.Text
getRow
(org.apache.hadoop.io.Text r) Writes the row ID into the givenText
.Returns the row ID as a byte sequence.int
getSize()
Same asgetLength()
.long
Gets the timestamp.int
hashCode()
boolean
Determines if this key is deleted (i.e., has a delete marker = true).void
readFields
(DataInput in) void
Sets this key's row, column family, column qualifier, column visibility, timestamp, and delete marker to be the same as another key's.void
setDeleted
(boolean deleted) Sets the delete marker on this key.void
setTimestamp
(long ts) Sets the timestamp.static String
toPrintableString
(byte[] ba, int offset, int len, int maxLen) Returns an ASCII printable string form of the given byte array, treating the bytes as ASCII characters.toString()
Converts this key to a string, not including timestamp or delete marker.Stringify thisKey
, avoiding truncation of each component, only limiting each component to a length ofInteger.MAX_VALUE
org.apache.accumulo.core.dataImpl.thrift.TKey
toThrift()
Converts this key to Thrift.void
write
(DataOutput out)
-
Field Details
-
row
protected byte[] row -
colFamily
protected byte[] colFamily -
colQualifier
protected byte[] colQualifier -
colVisibility
protected byte[] colVisibility -
timestamp
protected long timestamp -
deleted
protected boolean deleted
-
-
Constructor Details
-
Key
public Key()Creates a key with empty row, empty column family, empty column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false. -
Key
public Key(org.apache.hadoop.io.Text row) Creates a key with the specified row, empty column family, empty column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false. This constructor creates a copy of row.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Parameters:
row
- row ID- See Also:
-
Key
public Key(byte[] row) Creates a key with the specified row, empty column family, empty column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false. This constructor creates a copy of row.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Parameters:
row
- row ID- Since:
- 1.8.0
- See Also:
-
Key
public Key(org.apache.hadoop.io.Text row, long ts) Creates a key with the specified row, empty column family, empty column qualifier, empty column visibility, the specified timestamp, and delete marker false. This constructor creates a copy of row.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Parameters:
row
- row IDts
- timestamp- See Also:
-
Key
public Key(byte[] row, long ts) Creates a key with the specified row, empty column family, empty column qualifier, empty column visibility, the specified timestamp, and delete marker false. This constructor creates a copy of row.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Parameters:
row
- row IDts
- timestamp- Since:
- 1.8.0
- See Also:
-
Key
public Key(byte[] row, int rOff, int rLen, byte[] cf, int cfOff, int cfLen, byte[] cq, int cqOff, int cqLen, byte[] cv, int cvOff, int cvLen, long ts) Creates a key. The delete marker defaults to false. This constructor creates a copy of each specified array.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Parameters:
row
- bytes containing row IDrOff
- offset into row where key's row ID begins (inclusive)rLen
- length of row ID in rowcf
- bytes containing column familycfOff
- offset into cf where key's column family begins (inclusive)cfLen
- length of column family in cfcq
- bytes containing column qualifiercqOff
- offset into cq where key's column qualifier begins (inclusive)cqLen
- length of column qualifier in cqcv
- bytes containing column visibilitycvOff
- offset into cv where key's column visibility begins (inclusive)cvLen
- length of column visibility in cvts
- timestamp- See Also:
-
Key
public Key(byte[] row, byte[] colFamily, byte[] colQualifier, byte[] colVisibility, long timestamp) Creates a key. The delete marker defaults to false. This constructor creates a copy of each specified array.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Parameters:
row
- row IDcolFamily
- column familycolQualifier
- column qualifiercolVisibility
- column visibilitytimestamp
- timestamp- See Also:
-
Key
public Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted) Creates a key. This constructor creates a copy of each specified arrays.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Parameters:
row
- row IDcf
- column familycq
- column qualifiercv
- column visibilityts
- timestampdeleted
- delete marker- See Also:
-
Key
public Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy) Creates a key.- Parameters:
row
- row IDcf
- column familycq
- column qualifiercv
- column visibilityts
- timestampdeleted
- delete markercopy
- if true, forces copy of byte array values into key- See Also:
-
Key
public Key(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf) Creates a key with the specified row, the specified column family, empty column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false. This constructor creates a copy of row.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- See Also:
-
Key
public Key(byte[] row, byte[] cf) Creates a key with the specified row, the specified column family, empty column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false. This constructor creates a copy of each specified array.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Since:
- 1.8.0
- See Also:
-
Key
public Key(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq) Creates a key with the specified row, the specified column family, the specified column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false. This constructor creates a copy of row.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- See Also:
-
Key
public Key(byte[] row, byte[] cf, byte[] cq) Creates a key with the specified row, the specified column family, the specified column qualifier, empty column visibility, timestampLong.MAX_VALUE
, and delete marker false. This constructor creates a copy of each specified array.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Since:
- 1.8.0
- See Also:
-
Key
public Key(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq, org.apache.hadoop.io.Text cv) Creates a key with the specified row, the specified column family, the specified column qualifier, the specified column visibility, timestampLong.MAX_VALUE
, and delete marker false. This constructor creates a copy of row.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- See Also:
-
Key
public Key(byte[] row, byte[] cf, byte[] cq, byte[] cv) Creates a key with the specified row, the specified column family, the specified column qualifier, the specified column visibility, timestampLong.MAX_VALUE
, and delete marker false. This constructor creates a copy of each specified array.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Since:
- 1.8.0
- See Also:
-
Key
public Key(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq, long ts) Creates a key with the specified row, the specified column family, the specified column qualifier, empty column visibility, the specified timestamp, and delete marker false. This constructor creates a copy of row.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- See Also:
-
Key
public Key(byte[] row, byte[] cf, byte[] cq, long ts) Creates a key with the specified row, the specified column family, the specified column qualifier, empty column visibility, the specified timestamp, and delete marker false. This constructor creates a copy of each specified array.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Since:
- 1.8.0
- See Also:
-
Key
public Key(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq, org.apache.hadoop.io.Text cv, long ts) Creates a key with the specified row, the specified column family, the specified column qualifier, the specified column visibility, the specified timestamp, and delete marker false. This constructor creates a copy of row.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- See Also:
-
Key
public Key(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq, ColumnVisibility cv, long ts) Creates a key with the specified row, the specified column family, the specified column qualifier, the specified column visibility, the specified timestamp, and delete marker false. This constructor creates a copy of row.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- See Also:
-
Key
Creates a key with the specified row, the specified column family, the specified column qualifier, the specified column visibility, the specified timestamp, and delete marker false. This constructor creates a copy of each specified array.To avoid copying, use
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.- Since:
- 1.8.0
- See Also:
-
Key
Converts CharSequence to Text and creates a Key usingKey(Text)
.- See Also:
-
Key
Converts CharSequence to Text and creates a Key usingKey(Text,Text)
.- See Also:
-
Key
Converts CharSequence to Text and creates a Key usingKey(Text,Text,Text)
.- See Also:
-
Key
Converts CharSequence to Text and creates a Key usingKey(Text,Text,Text,Text)
.- See Also:
-
Key
Converts CharSequence to Text and creates a Key usingKey(Text,Text,Text,long)
.- See Also:
-
Key
Converts CharSequence to Text and creates a Key usingKey(Text,Text,Text,Text,long)
.- See Also:
-
Key
Converts CharSequence to Text and creates a Key usingKey(Text,Text,Text,ColumnVisibility,long)
.- See Also:
-
Key
Creates a key with the same row, column family, column qualifier, column visibility, timestamp, and delete marker as the given key. -
Key
public Key(org.apache.accumulo.core.dataImpl.thrift.TKey tkey) Creates a key from Thrift.- Parameters:
tkey
- Thrift key
-
-
Method Details
-
builder
Create aKey
builder.- Parameters:
copyBytes
- if the bytes of theKey
components should be copied- Returns:
- the builder at the
KeyBuilder.RowStep
- Since:
- 2.0
-
builder
Create aKey
builder. Using the builder makes it easy to mix types, likeString
andbyte[]
, for different fields. Copy bytes defaults to true.- Returns:
- the builder at the
KeyBuilder.RowStep
- Since:
- 2.0
- See Also:
-
equals
-
followingKey
Returns a key that will sort immediately after this key.- Parameters:
part
- PartialKey exceptPartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL
-
getRow
public org.apache.hadoop.io.Text getRow(org.apache.hadoop.io.Text r) Writes the row ID into the givenText
. This method gives users control over allocation of Text objects by copying into the passed in text.- Parameters:
r
-Text
object to copy into- Returns:
- the
Text
that was passed in
-
getRowData
Returns the row ID as a byte sequence. This method returns a pointer to the key's internal data and does not copy it.- Returns:
- ByteSequence that points to the internal key row ID data
-
getRow
public org.apache.hadoop.io.Text getRow()Gets the row ID as aText
object.- Returns:
- Text containing the row ID
-
compareRow
public int compareRow(org.apache.hadoop.io.Text r) Compares this key's row ID with another.- Parameters:
r
- row ID to compare- Returns:
- same as
getRow()
.compareTo(r)
-
getColumnFamilyData
Returns the column family as a byte sequence. This method returns a pointer to the key's internal data and does not copy it.- Returns:
- ByteSequence that points to the internal key column family data
-
getColumnFamily
public org.apache.hadoop.io.Text getColumnFamily(org.apache.hadoop.io.Text cf) Writes the column family into the givenText
. This method gives users control over allocation of Text objects by copying into the passed in text.- Parameters:
cf
-Text
object to copy into- Returns:
- the
Text
that was passed in
-
getColumnFamily
public org.apache.hadoop.io.Text getColumnFamily()Gets the column family as aText
object.- Returns:
- Text containing the column family
-
compareColumnFamily
public int compareColumnFamily(org.apache.hadoop.io.Text cf) Compares this key's column family with another.- Parameters:
cf
- column family to compare- Returns:
- same as
getColumnFamily()
.compareTo(cf)
-
getColumnQualifierData
Returns the column qualifier as a byte sequence. This method returns a pointer to the key's internal data and does not copy it.- Returns:
- ByteSequence that points to the internal key column qualifier data
-
getColumnQualifier
public org.apache.hadoop.io.Text getColumnQualifier(org.apache.hadoop.io.Text cq) Writes the column qualifier into the givenText
. This method gives users control over allocation of Text objects by copying into the passed in text.- Parameters:
cq
-Text
object to copy into- Returns:
- the
Text
that was passed in
-
getColumnQualifier
public org.apache.hadoop.io.Text getColumnQualifier()Gets the column qualifier as aText
object.- Returns:
- Text containing the column qualifier
-
compareColumnQualifier
public int compareColumnQualifier(org.apache.hadoop.io.Text cq) Compares this key's column qualifier with another.- Parameters:
cq
- column qualifier to compare- Returns:
- same as
getColumnQualifier()
.compareTo(cq)
-
setTimestamp
public void setTimestamp(long ts) Sets the timestamp.- Parameters:
ts
- timestamp
-
getTimestamp
public long getTimestamp()Gets the timestamp.- Returns:
- timestamp
-
isDeleted
public boolean isDeleted()Determines if this key is deleted (i.e., has a delete marker = true).- Returns:
- true if key is deleted, false if not
-
setDeleted
public void setDeleted(boolean deleted) Sets the delete marker on this key.- Parameters:
deleted
- delete marker (true to delete)
-
getColumnVisibilityData
Returns the column visibility as a byte sequence. This method returns a pointer to the key's internal data and does not copy it.- Returns:
- ByteSequence that points to the internal key column visibility data
-
getColumnVisibility
public final org.apache.hadoop.io.Text getColumnVisibility()Gets the column visibility as aText
object.- Returns:
- Text containing the column visibility
-
getColumnVisibility
public final org.apache.hadoop.io.Text getColumnVisibility(org.apache.hadoop.io.Text cv) Writes the column visibility into the givenText
. This method gives users control over allocation of Text objects by copying into the passed in text.- Parameters:
cv
-Text
object to copy into- Returns:
- the
Text
that was passed in
-
getColumnVisibilityParsed
Gets the column visibility. WARNING: using this method may inhibit performance since a new ColumnVisibility object is created on every call.- Returns:
- ColumnVisibility representing the column visibility
- Since:
- 1.5.0
-
set
Sets this key's row, column family, column qualifier, column visibility, timestamp, and delete marker to be the same as another key's. This method does not copy data from the other key, but only references to it.- Parameters:
k
- key to set from
-
readFields
- Specified by:
readFields
in interfaceorg.apache.hadoop.io.Writable
- Throws:
IOException
-
write
- Specified by:
write
in interfaceorg.apache.hadoop.io.Writable
- Throws:
IOException
-
equals
Compares part of a key. For example, compares just the row and column family, and if those are equal then return true.- Parameters:
other
- key to compare topart
- part of key to compare- Returns:
- true if specified parts of keys match, false otherwise
-
compareTo
Compares elements of a key given by aPartialKey
. The corresponding elements (row, column family, column qualifier, column visibility, timestamp, and delete marker) are compared in order until unequal elements are found. The row, column family, column qualifier, and column visibility are compared lexicographically and sorted ascending. The timestamps are compared numerically and sorted descending so that the most recent data comes first. Lastly, a delete marker of true sorts before a delete marker of false. The result of the first unequal comparison is returned. For example, forPartialKey.ROW_COLFAM
, this method compares just the row and column family. If the row IDs are not equal, return the result of the row comparison; otherwise, returns the result of the column family comparison.- Parameters:
other
- key to compare topart
- part of key to compare- Returns:
- comparison result
- See Also:
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Key>
-
hashCode
public int hashCode() -
toPrintableString
Returns an ASCII printable string form of the given byte array, treating the bytes as ASCII characters. SeeappendPrintableString(byte[], int, int, int, StringBuilder)
for caveats.- Parameters:
ba
- byte arrayoffset
- offset to start with in byte array (inclusive)len
- number of bytes to printmaxLen
- maximum number of bytes to convert to printable form- Returns:
- printable string
- See Also:
-
appendPrintableString
public static StringBuilder appendPrintableString(byte[] ba, int offset, int len, int maxLen, StringBuilder sb) Appends ASCII printable characters to a string, based on the given byte array, treating the bytes as ASCII characters. If a byte can be converted to a ASCII printable character it is appended as is; otherwise, it is appended as a character code, e.g., %05; for byte value 5. If len > maxlen, the string includes a "TRUNCATED" note at the end.- Parameters:
ba
- byte arrayoffset
- offset to start with in byte array (inclusive)len
- number of bytes to printmaxLen
- maximum number of bytes to convert to printable formsb
-StringBuilder
to append to- Returns:
- given
StringBuilder
-
toString
-
toStringNoTruncate
Stringify thisKey
, avoiding truncation of each component, only limiting each component to a length ofInteger.MAX_VALUE
- Since:
- 1.7.0
-
toStringNoTime
Converts this key to a string, not including timestamp or delete marker.- Returns:
- string form of key
-
getLength
public int getLength()Returns the sums of the lengths of the row, column family, column qualifier, and column visibility.- Returns:
- sum of key field lengths
-
getSize
public int getSize()Same asgetLength()
.- Returns:
- sum of key field lengths
-
compress
public static List<org.apache.accumulo.core.dataImpl.thrift.TKeyValue> compress(List<? extends KeyValue> param) Compresses a list of key/value pairs before sending them via thrift.- Parameters:
param
- list of key/value pairs- Returns:
- list of Thrift key/value pairs
-
decompress
Decompresses a list of key/value pairs received from thrift. Decompression occurs in place, in the list.- Parameters:
param
- list of Thrift key/value pairs
-
toThrift
public org.apache.accumulo.core.dataImpl.thrift.TKey toThrift()Converts this key to Thrift.- Returns:
- Thrift key
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-