public class TopNHash extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
TopNHash.BinaryCollector
For interaction between operator and top-n hash.
|
Modifier and Type | Field and Description |
---|---|
protected int[] |
batchIndexToResult |
protected int |
batchSize |
protected TopNHash.BinaryCollector |
collector |
static int |
EXCLUDE |
static int |
FORWARD |
protected boolean |
isEnabled |
protected long |
threshold |
protected int |
topN |
protected long |
usage |
Constructor and Description |
---|
TopNHash() |
Modifier and Type | Method and Description |
---|---|
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,
OperatorDesc conf,
org.apache.hadoop.conf.Configuration hconf) |
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 static final int FORWARD
public static final int EXCLUDE
protected TopNHash.BinaryCollector collector
protected int topN
protected long threshold
protected long usage
protected int[] batchIndexToResult
protected int batchSize
protected boolean isEnabled
public void initialize(int topN, float memUsage, boolean isMapGroupBy, TopNHash.BinaryCollector collector, OperatorDesc conf, org.apache.hadoop.conf.Configuration hconf)
public int tryStoreKey(HiveKey key, boolean partColsIsNull) throws HiveException, IOException
key
- Serialized key.HiveException
IOException
public int startVectorizedBatch(int size) throws IOException, HiveException
size
- batch sizeIOException
HiveException
public void tryStoreVectorizedKey(HiveKey key, boolean partColsIsNull, int batchIndex) throws HiveException, IOException
key
- the key.batchIndex
- The index of the key in the vectorized batch (sequential, not .selected).HiveException
IOException
public int getVectorizedBatchResult(int batchIndex)
batchIndex
- index of the key in the batch.#tryStoreKey(HiveKey)
public HiveKey getVectorizedKeyToForward(int batchIndex)
batchIndex
- index of the key in the batch.public int getVectorizedKeyDistLength(int batchIndex)
batchIndex
- index of the key in the batch.public int getVectorizedKeyHashCode(int batchIndex)
batchIndex
- index of the key in the batch.public void storeValue(int index, int hashCode, org.apache.hadoop.io.BytesWritable value, boolean vectorized)
index
- The index, either from tryStoreKey or from tryStoreVectorizedKey result.hasCode
- hashCode of key, used by ptfTopNHash.value
- The value to store.keyHash
- The key hash to store.vectorized
- Whether the result is coming from a vectorized batch.public void flush() throws HiveException
HiveException
Copyright © 2022 The Apache Software Foundation. All rights reserved.