|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.codec.prefixtree.encode.other.LongEncoder
@InterfaceAudience.Private public class LongEncoder
Used to de-duplicate, sort, minimize/diff, and serialize timestamps and mvccVersions from a collection of Cells. 1. add longs to a HashSet for fast de-duplication 2. keep track of the min and max 3. copy all values to a new long[] 4. Collections.sort the long[] 5. calculate maxDelta = max - min 6. determine FInt width based on maxDelta 7. PrefixTreeEncoder binary searches to find index of each value
| Field Summary | |
|---|---|
protected int |
bytesPerDelta
|
protected int |
bytesPerIndex
|
protected long |
max
|
protected long |
maxDelta
|
protected long |
min
|
protected long[] |
sortedUniqueValues
|
protected int |
totalCompressedBytes
|
protected HashSet<Long> |
uniqueValues
fields |
| Constructor Summary | |
|---|---|
LongEncoder()
construct |
|
| Method Summary | |
|---|---|
void |
add(long timestamp)
methods |
LongEncoder |
compile()
|
byte[] |
getByteArray()
|
int |
getBytesPerDelta()
|
int |
getBytesPerIndex()
|
long |
getDelta(int index)
|
int |
getIndex(long value)
|
long |
getMin()
get/set |
int |
getNumUniqueValues()
|
int |
getOutputArrayLength()
|
long[] |
getSortedUniqueTimestamps()
|
int |
getTotalCompressedBytes()
|
void |
reset()
|
String |
toString()
Object methods |
void |
writeBytes(OutputStream os)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected HashSet<Long> uniqueValues
protected long[] sortedUniqueValues
protected long min
protected long max
protected long maxDelta
protected int bytesPerDelta
protected int bytesPerIndex
protected int totalCompressedBytes
| Constructor Detail |
|---|
public LongEncoder()
| Method Detail |
|---|
public void reset()
public void add(long timestamp)
public LongEncoder compile()
public long getDelta(int index)
public int getIndex(long value)
public void writeBytes(OutputStream os)
throws IOException
IOException
public byte[] getByteArray()
throws IOException
IOExceptionpublic int getOutputArrayLength()
public int getNumUniqueValues()
public String toString()
toString in class Objectpublic long getMin()
public int getBytesPerDelta()
public int getBytesPerIndex()
public int getTotalCompressedBytes()
public long[] getSortedUniqueTimestamps()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||