public class Bucket extends Object implements Comparable<Bucket>
Bucket bound is the smallest and greatest values stored in the bucket. The lower and upper bound are stored in bucket as lowerBound and upperBound.
A bucket count is the number of items stored in all previous buckets and the current bucket. Bucket counts are always in increasing order.
A bucket repeat is the number of repeats of the greatest bucket value, it can be used to find popular values.
Note that lowerBound and upperBound keys should be 'comparable objects', and these bounds are encoded as `binary` type in TiDB. Intuitively, you should also use Keys encoded as binary format to do comparison in row count estimation.
Modifier and Type | Field and Description |
---|---|
long |
count |
Constructor and Description |
---|
Bucket(Key upperBound)
used for binary search only
|
Bucket(long count,
long repeats,
Key lowerBound,
Key upperBound) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Bucket b) |
long |
getCount() |
Key |
getLowerBound() |
long |
getRepeats() |
Key |
getUpperBound() |
void |
setCount(long count) |
void |
setLowerBound(Key lowerBound) |
void |
setRepeats(long repeats) |
void |
setUpperBound(Key upperBound) |
String |
toString() |
public Bucket(Key upperBound)
public int compareTo(Bucket b)
compareTo
in interface Comparable<Bucket>
public long getCount()
public void setCount(long count)
public long getRepeats()
public void setRepeats(long repeats)
public Key getLowerBound()
public void setLowerBound(Key lowerBound)
public Key getUpperBound()
public void setUpperBound(Key upperBound)
Copyright © 2024 PingCAP. All rights reserved.