E
- encoded vector type.D
- decoded vector type, which is also the dictionary type.public class SearchDictionaryEncoder<E extends BaseIntVector,D extends ValueVector> extends Object implements DictionaryEncoder<E,D>
Constructor and Description |
---|
SearchDictionaryEncoder(D dictionary,
VectorValueComparator<D> comparator)
Constructs a dictionary encoder.
|
SearchDictionaryEncoder(D dictionary,
VectorValueComparator<D> comparator,
boolean encodeNull)
Constructs a dictionary encoder.
|
Modifier and Type | Method and Description |
---|---|
void |
encode(D input,
E output)
Encodes an input vector by binary search.
|
public SearchDictionaryEncoder(D dictionary, VectorValueComparator<D> comparator)
dictionary
- the dictionary. It must be in sorted order.comparator
- the criteria for sorting.public SearchDictionaryEncoder(D dictionary, VectorValueComparator<D> comparator, boolean encodeNull)
dictionary
- the dictionary. It must be in sorted order.comparator
- the criteria for sorting.encodeNull
- a flag indicating if null should be encoded.
It determines the behaviors for processing null values in the input during encoding.
When a null is encountered in the input,
1) If the flag is set to true, the encoder searches for the value in the dictionary,
and outputs the index in the dictionary.
2) If the flag is set to false, the encoder simply produces a null in the output.public void encode(D input, E output)
encode
in interface DictionaryEncoder<E extends BaseIntVector,D extends ValueVector>
input
- the input vector.output
- the output vector. Note that it must be in a fresh state. At least,
all its validity bits should be clear.Copyright © 2023 The Apache Software Foundation. All rights reserved.