V - the dictionary vector type.public class HashTableBasedDictionaryBuilder<V extends ElementAddressableVector> extends Object
This class builds the dictionary based on a hash table. Each add operation can be finished in O(1) time, where n is the current dictionary size.
The dictionary builder is intended to build a single dictionary. So it cannot be used for different dictionaries.
Below gives the sample code for using the dictionary builder
HashTableBasedDictionaryBuilder dictionaryBuilder = ...
...
dictionaryBuild.addValue(newValue);
...
With the above code, the dictionary vector will be populated,
and it can be retrieved by the getDictionary() method.
After that, dictionary encoding can proceed with the populated dictionary encoder.
| Constructor and Description |
|---|
HashTableBasedDictionaryBuilder(V dictionary)
Constructs a hash table based dictionary builder.
|
HashTableBasedDictionaryBuilder(V dictionary,
boolean encodeNull)
Constructs a hash table based dictionary builder.
|
HashTableBasedDictionaryBuilder(V dictionary,
boolean encodeNull,
ArrowBufHasher hasher)
Constructs a hash table based dictionary builder.
|
| Modifier and Type | Method and Description |
|---|---|
int |
addValue(V targetVector,
int targetIndex)
Try to add an element from the target vector to the dictionary.
|
int |
addValues(V targetVector)
Try to add all values from the target vector to the dictionary.
|
V |
getDictionary()
Gets the dictionary built.
|
public HashTableBasedDictionaryBuilder(V dictionary)
dictionary - the dictionary to populate.public HashTableBasedDictionaryBuilder(V dictionary, boolean encodeNull)
dictionary - the dictionary to populate.encodeNull - if null values should be added to the dictionary.public HashTableBasedDictionaryBuilder(V dictionary, boolean encodeNull, ArrowBufHasher hasher)
dictionary - the dictionary to populate.encodeNull - if null values should be added to the dictionary.hasher - the hasher used to compute the hash code.public V getDictionary()
public int addValues(V targetVector)
targetVector - the target vector containing values to probe.public int addValue(V targetVector, int targetIndex)
targetVector - the target vector containing new element.targetIndex - the index of the new element in the target vector.Copyright © 2019 The Apache Software Foundation. All rights reserved.