public class PTFTopNHash extends TopNHash
TopNHash.BinaryCollector
Modifier and Type | Field and Description |
---|---|
protected boolean |
isMapGroupBy |
protected float |
memUsage |
Constructor and Description |
---|
PTFTopNHash() |
Modifier and Type | Method and Description |
---|---|
int |
_tryStoreKey(HiveKey key,
boolean partColsIsNull,
int batchIndex) |
void |
flush()
Flushes all the rows cached in the heap.
|
int |
getVectorizedBatchResult(int batchIndex)
Get vectorized batch result for particular index.
|
int |
getVectorizedKeyDistLength(int batchIndex)
After vectorized batch is processed, can return distribution keys length of a key.
|
int |
getVectorizedKeyHashCode(int batchIndex)
After vectorized batch is processed, can return hashCode of a key.
|
HiveKey |
getVectorizedKeyToForward(int batchIndex)
After vectorized batch is processed, can return the key that caused a particular row
to be forwarded.
|
void |
initialize(int topN,
float memUsage,
boolean isMapGroupBy,
TopNHash.BinaryCollector collector) |
int |
startVectorizedBatch(int size)
Perform basic checks and initialize TopNHash for the new vectorized row batch.
|
void |
storeValue(int index,
int hashCode,
org.apache.hadoop.io.BytesWritable value,
boolean vectorized)
Stores the value for the key in the heap.
|
int |
tryStoreKey(HiveKey key,
boolean partColsIsNull)
Try store the non-vectorized key.
|
void |
tryStoreVectorizedKey(HiveKey key,
boolean partColsIsNull,
int batchIndex)
Try to put the key from the current vectorized batch into the heap.
|
public void initialize(int topN, float memUsage, boolean isMapGroupBy, TopNHash.BinaryCollector collector)
initialize
in class TopNHash
public int tryStoreKey(HiveKey key, boolean partColsIsNull) throws HiveException, IOException
TopNHash
tryStoreKey
in class TopNHash
key
- Serialized key.HiveException
IOException
public int _tryStoreKey(HiveKey key, boolean partColsIsNull, int batchIndex) throws HiveException, IOException
HiveException
IOException
public void storeValue(int index, int hashCode, org.apache.hadoop.io.BytesWritable value, boolean vectorized)
TopNHash
storeValue
in class TopNHash
index
- The index, either from tryStoreKey or from tryStoreVectorizedKey result.value
- The value to store.vectorized
- Whether the result is coming from a vectorized batch.public void flush() throws HiveException
TopNHash
flush
in class TopNHash
HiveException
public int startVectorizedBatch(int size) throws IOException, HiveException
TopNHash
startVectorizedBatch
in class TopNHash
size
- batch sizeIOException
HiveException
public void tryStoreVectorizedKey(HiveKey key, boolean partColsIsNull, int batchIndex) throws HiveException, IOException
TopNHash
tryStoreVectorizedKey
in class TopNHash
key
- the key.batchIndex
- The index of the key in the vectorized batch (sequential, not .selected).HiveException
IOException
public int getVectorizedBatchResult(int batchIndex)
TopNHash
getVectorizedBatchResult
in class TopNHash
batchIndex
- index of the key in the batch.#tryStoreKey(HiveKey)
public HiveKey getVectorizedKeyToForward(int batchIndex)
TopNHash
getVectorizedKeyToForward
in class TopNHash
batchIndex
- index of the key in the batch.public int getVectorizedKeyDistLength(int batchIndex)
TopNHash
getVectorizedKeyDistLength
in class TopNHash
batchIndex
- index of the key in the batch.public int getVectorizedKeyHashCode(int batchIndex)
TopNHash
getVectorizedKeyHashCode
in class TopNHash
batchIndex
- index of the key in the batch.Copyright © 2017 The Apache Software Foundation. All rights reserved.