public class Key extends Object implements org.apache.hadoop.io.WritableComparable<Key>, Cloneable
compareTo(Key)
.Modifier and Type | Field and Description |
---|---|
protected byte[] |
colFamily |
protected byte[] |
colQualifier |
protected byte[] |
colVisibility |
protected boolean |
deleted |
protected byte[] |
row |
protected long |
timestamp |
Constructor and Description |
---|
Key()
Creates a key with empty row, empty column family, empty column qualifier, empty column
visibility, timestamp
Long.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, timestamp
Long.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, timestamp
Long.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, timestamp
Long.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, timestamp
Long.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,
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,
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,
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 using
Key(Text) . |
Key(CharSequence row,
CharSequence cf)
Converts CharSequence to Text and creates a Key using
Key(Text,Text) . |
Key(CharSequence row,
CharSequence cf,
CharSequence cq)
Converts CharSequence to Text and creates a Key using
Key(Text,Text,Text) . |
Key(CharSequence row,
CharSequence cf,
CharSequence cq,
CharSequence cv)
Converts CharSequence to Text and creates a Key using
Key(Text,Text,Text,Text) . |
Key(CharSequence row,
CharSequence cf,
CharSequence cq,
CharSequence cv,
long ts)
Converts CharSequence to Text and creates a Key using
Key(Text,Text,Text,Text,long) . |
Key(CharSequence row,
CharSequence cf,
CharSequence cq,
ColumnVisibility cv,
long ts)
Converts CharSequence to Text and creates a Key using
Key(Text,Text,Text,ColumnVisibility,long) . |
Key(CharSequence row,
CharSequence cf,
CharSequence cq,
long ts)
Converts CharSequence to Text and creates a Key using
Key(Text,Text,Text,long) . |
Key(Key other)
Creates a key with the same row, column family, column qualifier, column visibility, timestamp,
and delete marker as the given key.
|
Key(org.apache.hadoop.io.Text row)
Creates a key with the specified row, empty column family, empty column qualifier, empty column
visibility, timestamp
Long.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, timestamp
Long.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, timestamp
Long.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,
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,
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,
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, timestamp
Long.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.
|
Key(org.apache.accumulo.core.data.thrift.TKey tkey)
Creates a key from Thrift.
|
Modifier and Type | Method and Description |
---|---|
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.
|
Object |
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 |
compareTo(Key other) |
int |
compareTo(Key other,
PartialKey part)
Compares elements of a key given by a
PartialKey . |
static List<org.apache.accumulo.core.data.thrift.TKeyValue> |
compress(List<? extends KeyValue> param)
Compresses a list of key/value pairs before sending them via thrift.
|
static void |
decompress(List<org.apache.accumulo.core.data.thrift.TKeyValue> param)
Decompresses a list of key/value pairs received from thrift.
|
boolean |
equals(Key other,
PartialKey part)
Compares part of a key.
|
boolean |
equals(Object o) |
Key |
followingKey(PartialKey part)
Returns a key that will sort immediately after this key.
|
org.apache.hadoop.io.Text |
getColumnFamily()
Gets the column family as a
Text object. |
org.apache.hadoop.io.Text |
getColumnFamily(org.apache.hadoop.io.Text cf)
Writes the column family into the given
Text . |
ByteSequence |
getColumnFamilyData()
Returns the column family as a byte sequence.
|
org.apache.hadoop.io.Text |
getColumnQualifier()
Gets the column qualifier as a
Text object. |
org.apache.hadoop.io.Text |
getColumnQualifier(org.apache.hadoop.io.Text cq)
Writes the column qualifier into the given
Text . |
ByteSequence |
getColumnQualifierData()
Returns the column qualifier as a byte sequence.
|
org.apache.hadoop.io.Text |
getColumnVisibility()
Gets the column visibility as a
Text object. |
org.apache.hadoop.io.Text |
getColumnVisibility(org.apache.hadoop.io.Text cv)
Writes the column visibvility into the given
Text . |
ByteSequence |
getColumnVisibilityData()
Returns the column visibility as a byte sequence.
|
ColumnVisibility |
getColumnVisibilityParsed()
Gets the column visibility.
|
int |
getLength()
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 a
Text object. |
org.apache.hadoop.io.Text |
getRow(org.apache.hadoop.io.Text r)
Writes the row ID into the given
Text . |
ByteSequence |
getRowData()
Returns the row ID as a byte sequence.
|
int |
getSize()
Same as
getLength() . |
long |
getTimestamp()
Gets the timestamp.
|
int |
hashCode() |
boolean |
isDeleted()
Determines if this key is deleted (i.e., has a delete marker = true).
|
void |
readFields(DataInput in) |
void |
set(Key k)
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.
|
String |
toString() |
String |
toStringNoTime()
Converts this key to a string, not including timestamp or delete marker.
|
String |
toStringNoTruncate()
Stringify this
Key , avoiding truncation of each component, only limiting each component
to a length of Integer.MAX_VALUE |
org.apache.accumulo.core.data.thrift.TKey |
toThrift()
Converts this key to Thrift.
|
void |
write(DataOutput out) |
protected byte[] row
protected byte[] colFamily
protected byte[] colQualifier
protected byte[] colVisibility
protected long timestamp
protected boolean deleted
public Key()
Long.MAX_VALUE
, and delete marker false.public Key(org.apache.hadoop.io.Text row)
Long.MAX_VALUE
, and delete marker false.row
- row IDpublic Key(byte[] row)
Long.MAX_VALUE
, and delete marker false. This constructor creates
a copy of row. If you don't want to create a copy of row, you should call
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.row
- row IDpublic Key(org.apache.hadoop.io.Text row, long ts)
row
- row IDts
- timestamppublic Key(byte[] row, long ts)
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.row
- row IDts
- timestamppublic 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)
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.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
- timestamppublic Key(byte[] row, byte[] colFamily, byte[] colQualifier, byte[] colVisibility, long timestamp)
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.row
- row IDcolFamily
- column familycolQualifier
- column qualifiercolVisibility
- column visibilitytimestamp
- timestamppublic Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted)
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.row
- row IDcf
- column familycq
- column qualifiercv
- column visibilityts
- timestampdeleted
- delete markerpublic Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
row
- row IDcf
- column familycq
- column qualifiercv
- column visibilityts
- timestampdeleted
- delete markercopy
- if true, forces copy of byte array values into keypublic Key(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf)
Long.MAX_VALUE
, and delete marker false.public Key(byte[] row, byte[] cf)
Long.MAX_VALUE
, and delete marker false. This
constructor creates a copy of each specified array. If you don't want to create a copy of the
arrays, you should call
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.public Key(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq)
Long.MAX_VALUE
, and delete marker false.public Key(byte[] row, byte[] cf, byte[] cq)
Long.MAX_VALUE
, and delete marker false.
This constructor creates a copy of each specified array. If you don't want to create a copy of
the arrays, you should call
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.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.MAX_VALUE
, and delete marker
false.public Key(byte[] row, byte[] cf, byte[] cq, byte[] cv)
Long.MAX_VALUE
, and delete marker
false. This constructor creates a copy of each specified array. If you don't want to create a
copy of the arrays, you should call
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.public Key(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq, long ts)
public Key(byte[] row, byte[] cf, byte[] cq, long ts)
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.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)
public Key(org.apache.hadoop.io.Text row, org.apache.hadoop.io.Text cf, org.apache.hadoop.io.Text cq, ColumnVisibility cv, long ts)
public Key(byte[] row, byte[] cf, byte[] cq, ColumnVisibility cv, long ts)
Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
instead.public Key(CharSequence row)
Key(Text)
.public Key(CharSequence row, CharSequence cf)
Key(Text,Text)
.public Key(CharSequence row, CharSequence cf, CharSequence cq)
Key(Text,Text,Text)
.public Key(CharSequence row, CharSequence cf, CharSequence cq, CharSequence cv)
Key(Text,Text,Text,Text)
.public Key(CharSequence row, CharSequence cf, CharSequence cq, long ts)
Key(Text,Text,Text,long)
.public Key(CharSequence row, CharSequence cf, CharSequence cq, CharSequence cv, long ts)
Key(Text,Text,Text,Text,long)
.public Key(CharSequence row, CharSequence cf, CharSequence cq, ColumnVisibility cv, long ts)
Key(Text,Text,Text,ColumnVisibility,long)
.public Key(Key other)
public Key(org.apache.accumulo.core.data.thrift.TKey tkey)
tkey
- Thrift keypublic Key followingKey(PartialKey part)
part
- PartialKey except PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL
public org.apache.hadoop.io.Text getRow(org.apache.hadoop.io.Text r)
Text
. This method gives users control over
allocation of Text objects by copying into the passed in text.r
- Text
object to copy intoText
that was passed inpublic ByteSequence getRowData()
public org.apache.hadoop.io.Text getRow()
Text
object.public int compareRow(org.apache.hadoop.io.Text r)
r
- row ID to comparegetRow()
.compareTo(r)public ByteSequence getColumnFamilyData()
public org.apache.hadoop.io.Text getColumnFamily(org.apache.hadoop.io.Text cf)
Text
. This method gives users control over
allocation of Text objects by copying into the passed in text.cf
- Text
object to copy intoText
that was passed inpublic org.apache.hadoop.io.Text getColumnFamily()
Text
object.public int compareColumnFamily(org.apache.hadoop.io.Text cf)
cf
- column family to comparegetColumnFamily()
.compareTo(cf)public ByteSequence getColumnQualifierData()
public org.apache.hadoop.io.Text getColumnQualifier(org.apache.hadoop.io.Text cq)
Text
. This method gives users control
over allocation of Text objects by copying into the passed in text.cq
- Text
object to copy intoText
that was passed inpublic org.apache.hadoop.io.Text getColumnQualifier()
Text
object.public int compareColumnQualifier(org.apache.hadoop.io.Text cq)
cq
- column qualifier to comparegetColumnQualifier()
.compareTo(cq)public void setTimestamp(long ts)
ts
- timestamppublic long getTimestamp()
public boolean isDeleted()
public void setDeleted(boolean deleted)
deleted
- delete marker (true to delete)public ByteSequence getColumnVisibilityData()
public final org.apache.hadoop.io.Text getColumnVisibility()
Text
object.public final org.apache.hadoop.io.Text getColumnVisibility(org.apache.hadoop.io.Text cv)
Text
. This method gives users control
over allocation of Text objects by copying into the passed in text.cv
- Text
object to copy intoText
that was passed inpublic final ColumnVisibility getColumnVisibilityParsed()
public void set(Key k)
k
- key to set frompublic void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public boolean equals(Key other, PartialKey part)
other
- key to compare topart
- part of key to comparepublic int compareTo(Key other, PartialKey part)
PartialKey
. 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 lexographically 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, for PartialKey.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.other
- key to compare topart
- part of key to comparecompareTo(Key)
public int compareTo(Key other)
compareTo
in interface Comparable<Key>
public static String toPrintableString(byte[] ba, int offset, int len, int maxLen)
appendPrintableString(byte[], int, int, int, StringBuilder)
for
caveats.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 formappendPrintableString(byte[], int, int, int, StringBuilder)
public static StringBuilder appendPrintableString(byte[] ba, int offset, int len, int maxLen, StringBuilder sb)
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 toStringBuilder
public String toStringNoTruncate()
Key
, avoiding truncation of each component, only limiting each component
to a length of Integer.MAX_VALUE
public String toStringNoTime()
public int getLength()
public int getSize()
getLength()
.public static List<org.apache.accumulo.core.data.thrift.TKeyValue> compress(List<? extends KeyValue> param)
param
- list of key/value pairspublic static void decompress(List<org.apache.accumulo.core.data.thrift.TKeyValue> param)
param
- list of Thrift key/value pairspublic org.apache.accumulo.core.data.thrift.TKey toThrift()
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.