org.apache.hadoop.hbase.codec.prefixtree.encode.other
Class LongEncoder

java.lang.Object
  extended by org.apache.hadoop.hbase.codec.prefixtree.encode.other.LongEncoder

@InterfaceAudience.Private
public class LongEncoder
extends Object

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

uniqueValues

protected HashSet<Long> uniqueValues
fields


sortedUniqueValues

protected long[] sortedUniqueValues

min

protected long min

max

protected long max

maxDelta

protected long maxDelta

bytesPerDelta

protected int bytesPerDelta

bytesPerIndex

protected int bytesPerIndex

totalCompressedBytes

protected int totalCompressedBytes
Constructor Detail

LongEncoder

public LongEncoder()
construct

Method Detail

reset

public void reset()

add

public void add(long timestamp)
methods


compile

public LongEncoder compile()

getDelta

public long getDelta(int index)

getIndex

public int getIndex(long value)

writeBytes

public void writeBytes(OutputStream os)
                throws IOException
Throws:
IOException

getByteArray

public byte[] getByteArray()
                    throws IOException
Throws:
IOException

getOutputArrayLength

public int getOutputArrayLength()

getNumUniqueValues

public int getNumUniqueValues()

toString

public String toString()
Object methods

Overrides:
toString in class Object

getMin

public long getMin()
get/set


getBytesPerDelta

public int getBytesPerDelta()

getBytesPerIndex

public int getBytesPerIndex()

getTotalCompressedBytes

public int getTotalCompressedBytes()

getSortedUniqueTimestamps

public long[] getSortedUniqueTimestamps()


Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.