Class Key

java.lang.Object
org.apache.accumulo.core.data.Key
All Implemented Interfaces:
Cloneable, Comparable<Key>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<Key>

public class Key extends Object implements org.apache.hadoop.io.WritableComparable<Key>, Cloneable
This is the Key used to store and access individual values in Accumulo. A Key is a tuple composed of a row, column family, column qualifier, column visibility, timestamp, and delete marker. Keys are comparable and therefore have a sorted order defined by compareTo(Key).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected byte[]
     
    protected byte[]
     
    protected byte[]
     
    protected boolean
     
    protected byte[]
     
    protected long
     
  • Constructor Summary

    Constructors
    Constructor
    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, 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.
    Converts CharSequence to Text and creates a Key using Key(Text).
    Converts CharSequence to Text and creates a Key using Key(Text,Text).
    Converts CharSequence to Text and creates a Key using Key(Text,Text,Text).
    Key(CharSequence row, CharSequence cf, CharSequence cq, long ts)
    Converts CharSequence to Text and creates a Key using Key(Text,Text,Text,long).
    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).
    Converts CharSequence to Text and creates a Key using Key(Text,Text,Text,ColumnVisibility,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.accumulo.core.data.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, 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, 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, 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.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
     
    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
     
    boolean
    equals(Key other, PartialKey part)
    Compares part of a key.
    Returns a key that will sort immediately after this key.
    org.apache.hadoop.io.Text
    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.
    Returns the column family as a byte sequence.
    org.apache.hadoop.io.Text
    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.
    Returns the column qualifier as a byte sequence.
    final org.apache.hadoop.io.Text
    Gets the column visibility as a Text object.
    final org.apache.hadoop.io.Text
    getColumnVisibility(org.apache.hadoop.io.Text cv)
    Writes the column visibvility into the given Text.
    Returns the column visibility as a byte sequence.
    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
    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.
    Returns the row ID as a byte sequence.
    int
    Same as getLength().
    long
    Gets the timestamp.
    int
     
    boolean
    Determines if this key is deleted (i.e., has a delete marker = true).
    void
     
    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.
     
    Converts this key to a string, not including timestamp or delete marker.
    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
    Converts this key to Thrift.
    void
     

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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, timestamp Long.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, timestamp Long.MAX_VALUE, and delete marker false.
      Parameters:
      row - row ID
    • Key

      public 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. 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.
      Parameters:
      row - row ID
      Since:
      1.8.0
    • 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.
      Parameters:
      row - row ID
      ts - timestamp
    • 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. If you don't want to create a copy, you should call Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy) instead.
      Parameters:
      row - row ID
      ts - timestamp
      Since:
      1.8.0
    • 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. 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.
      Parameters:
      row - bytes containing row ID
      rOff - offset into row where key's row ID begins (inclusive)
      rLen - length of row ID in row
      cf - bytes containing column family
      cfOff - offset into cf where key's column family begins (inclusive)
      cfLen - length of column family in cf
      cq - bytes containing column qualifier
      cqOff - offset into cq where key's column qualifier begins (inclusive)
      cqLen - length of column qualifier in cq
      cv - bytes containing column visibility
      cvOff - offset into cv where key's column visibility begins (inclusive)
      cvLen - length of column visibility in cv
      ts - timestamp
    • 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. 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.
      Parameters:
      row - row ID
      colFamily - column family
      colQualifier - column qualifier
      colVisibility - column visibility
      timestamp - timestamp
    • 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. If you don't want to create a copy, you should call Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy) instead.
      Parameters:
      row - row ID
      cf - column family
      cq - column qualifier
      cv - column visibility
      ts - timestamp
      deleted - delete marker
    • Key

      public Key(byte[] row, byte[] cf, byte[] cq, byte[] cv, long ts, boolean deleted, boolean copy)
      Creates a key.
      Parameters:
      row - row ID
      cf - column family
      cq - column qualifier
      cv - column visibility
      ts - timestamp
      deleted - delete marker
      copy - if true, forces copy of byte array values into key
    • 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, timestamp Long.MAX_VALUE, and delete marker false.
    • Key

      public 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. 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.
      Since:
      1.8.0
    • 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, timestamp Long.MAX_VALUE, and delete marker false.
    • 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, timestamp 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.
      Since:
      1.8.0
    • 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, timestamp Long.MAX_VALUE, and delete marker false.
    • 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, timestamp 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.
      Since:
      1.8.0
    • 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.
    • 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. 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.
      Since:
      1.8.0
    • 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.
    • 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.
    • Key

      public 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. 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.
      Since:
      1.8.0
    • Key

      public Key(CharSequence row)
      Converts CharSequence to Text and creates a Key using Key(Text).
    • Key

      public Key(CharSequence row, CharSequence cf)
      Converts CharSequence to Text and creates a Key using Key(Text,Text).
    • Key

      public Key(CharSequence row, CharSequence cf, CharSequence cq)
      Converts CharSequence to Text and creates a Key using Key(Text,Text,Text).
    • Key

      public Key(CharSequence row, CharSequence cf, CharSequence cq, CharSequence cv)
      Converts CharSequence to Text and creates a Key using Key(Text,Text,Text,Text).
    • Key

      public Key(CharSequence row, CharSequence cf, CharSequence cq, long ts)
      Converts CharSequence to Text and creates a Key using Key(Text,Text,Text,long).
    • Key

      public 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

      public 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

      public 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

      public Key(org.apache.accumulo.core.data.thrift.TKey tkey)
      Creates a key from Thrift.
      Parameters:
      tkey - Thrift key
  • Method Details

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • followingKey

      public Key followingKey(PartialKey part)
      Returns a key that will sort immediately after this key.
      Parameters:
      part - PartialKey except PartialKey.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 given Text. 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

      public ByteSequence 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 a Text 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

      public ByteSequence 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 given Text. 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 a Text 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

      public ByteSequence 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 given Text. 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 a Text 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

      public ByteSequence 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 a Text 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 visibvility into the given Text. 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

      public final ColumnVisibility 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

      public 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. This method does not copy data from the other key, but only references to it.
      Parameters:
      k - key to set from
    • readFields

      public void readFields(DataInput in) throws IOException
      Specified by:
      readFields in interface org.apache.hadoop.io.Writable
      Throws:
      IOException
    • write

      public void write(DataOutput out) throws IOException
      Specified by:
      write in interface org.apache.hadoop.io.Writable
      Throws:
      IOException
    • equals

      public boolean equals(Key other, PartialKey part)
      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 to
      part - part of key to compare
      Returns:
      true if specified parts of keys match, false otherwise
    • compareTo

      public int compareTo(Key other, PartialKey part)
      Compares elements of a key given by a 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.
      Parameters:
      other - key to compare to
      part - part of key to compare
      Returns:
      comparison result
      See Also:
    • compareTo

      public int compareTo(Key other)
      Specified by:
      compareTo in interface Comparable<Key>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toPrintableString

      public 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. See appendPrintableString(byte[], int, int, int, StringBuilder) for caveats.
      Parameters:
      ba - byte array
      offset - offset to start with in byte array (inclusive)
      len - number of bytes to print
      maxLen - 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 array
      offset - offset to start with in byte array (inclusive)
      len - number of bytes to print
      maxLen - maximum number of bytes to convert to printable form
      sb - StringBuilder to append to
      Returns:
      given StringBuilder
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toStringNoTruncate

      public String toStringNoTruncate()
      Stringify this Key, avoiding truncation of each component, only limiting each component to a length of Integer.MAX_VALUE
      Since:
      1.7.0
    • toStringNoTime

      public String 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 as getLength().
      Returns:
      sum of key field lengths
    • compress

      public 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.
      Parameters:
      param - list of key/value pairs
      Returns:
      list of Thrift key/value pairs
    • decompress

      public static void decompress(List<org.apache.accumulo.core.data.thrift.TKeyValue> param)
      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.data.thrift.TKey toThrift()
      Converts this key to Thrift.
      Returns:
      Thrift key
    • clone

      public Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException