Package org.apache.druid.frame.key
Class ClusterBy
java.lang.Object
org.apache.druid.frame.key.ClusterBy
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbucketComparator(RowSignature rowSignature) Comparator that compares bucket keys for this instance.Comparator<byte[]>byteKeyComparator(RowSignature rowSignature) Comparator that compares byte arrays of keys for this instance using the given signature directly.booleanintHow many fields fromgetColumns()comprise the "bucket key".The columns that comprise this key, in order.inthashCode()booleanisEmpty()Whether this key is empty.keyComparator(RowSignature rowSignature) Comparator that compares keys for this instance using the given signature.keyReader(ColumnInspector inspector, FrameType frameType) Create a reader for keys for this instance.static ClusterBynone()Create an empty key.booleansortable()Whether this key is sortable.toString()
-
Constructor Details
-
ClusterBy
-
-
Method Details
-
none
Create an empty key. -
getColumns
The columns that comprise this key, in order. -
getBucketByCount
public int getBucketByCount()How many fields fromgetColumns()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 ofgetColumns(). 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
Create a reader for keys for this instance. The providedColumnInspectoris 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
Comparator that compares keys for this instance using the given signature. -
byteKeyComparator
Comparator that compares byte arrays of keys for this instance using the given signature directly. -
bucketComparator
Comparator that compares bucket keys for this instance. Bucket keys are retrieved by callingRowKeyReader.trim(RowKey, int)withgetBucketByCount(). -
equals
-
hashCode
public int hashCode() -
toString
-