Class ClusterBy


  • public class ClusterBy
    extends Object
    Describes a key used for sorting or partitioning. Keys have columns, and some of those columns may comprise a "bucket key". See getBucketByCount() for details about bucket keys.
    • Constructor Detail

      • ClusterBy

        public ClusterBy​(List<KeyColumn> columns,
                         int bucketByCount)
    • Method Detail

      • none

        public static ClusterBy none()
        Create an empty key.
      • getColumns

        public List<KeyColumn> getColumns()
        The columns that comprise this key, in order.
      • getBucketByCount

        public int getBucketByCount()
        How many fields from getColumns() comprise the "bucket key". Bucketing is like strict partitioning: all rows in a given partition will have the exact same bucket key. It is most commonly used to implement segment granularity during ingestion. The bucket key is a prefix of the complete key. Will always be less than, or equal to, the size of getColumns(). Only relevant when a ClusterBy instance is used as a partitioning key.
      • isEmpty

        public boolean isEmpty()
        Whether this key is empty.
      • sortable

        public boolean sortable()
        Whether this key is sortable. Empty keys (with no columns) are considered sortable.
      • keyReader

        public RowKeyReader keyReader​(ColumnInspector inspector)
        Create a reader for keys for this instance. The provided ColumnInspector is used to determine the types of fields in the keys. The provided signature does not have to exactly match the sortColumns: it merely has to contain them all.
      • keyComparator

        public Comparator<RowKey> keyComparator()
        Comparator that compares keys for this instance using the given signature.
      • byteKeyComparator

        public Comparator<byte[]> byteKeyComparator()
        Comparator that compares byte arrays of keys for this instance using the given signature directly.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object