V - the dictionary vector type.public class SearchTreeBasedDictionaryBuilder<V extends ValueVector> extends Object
This class builds the dictionary based on a binary search tree. Each add operation can be finished in O(log(n)) 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
SearchTreeBasedDictionaryBuilder 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.
| Modifier and Type | Field and Description |
|---|---|
protected VectorValueComparator<V> |
comparator
The criteria for sorting in the search tree.
|
| Constructor and Description |
|---|
SearchTreeBasedDictionaryBuilder(V dictionary,
VectorValueComparator<V> comparator)
Construct a search tree-based dictionary builder.
|
SearchTreeBasedDictionaryBuilder(V dictionary,
VectorValueComparator<V> comparator,
boolean encodeNull)
Construct a search tree-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.
|
void |
populateSortedDictionary(V sortedDictionary)
Gets the sorted dictionary.
|
protected final VectorValueComparator<V extends ValueVector> comparator
public SearchTreeBasedDictionaryBuilder(V dictionary, VectorValueComparator<V> comparator)
dictionary - the dictionary vector.comparator - the criteria for value equality.public SearchTreeBasedDictionaryBuilder(V dictionary, VectorValueComparator<V> comparator, boolean encodeNull)
dictionary - the dictionary vector.comparator - the criteria for value equality.encodeNull - if null values should be added to the dictionary.public V getDictionary()
populateSortedDictionary(ValueVector).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.public void populateSortedDictionary(V sortedDictionary)
Copyright © 2019 The Apache Software Foundation. All rights reserved.