E
- encoded vector type.D
- decoded vector type, which is also the dictionary type.public class LinearDictionaryEncoder<E extends BaseIntVector,D extends ValueVector> extends Object implements DictionaryEncoder<E,D>
Constructor and Description |
---|
LinearDictionaryEncoder(D dictionary)
Constructs a dictionary encoder, with the encode null flag set to false.
|
LinearDictionaryEncoder(D dictionary,
boolean encodeNull)
Constructs a dictionary encoder.
|
Modifier and Type | Method and Description |
---|---|
void |
encode(D input,
E output)
Encodes an input vector by linear search.
|
public LinearDictionaryEncoder(D dictionary)
dictionary
- the dictionary. Its entries should be sorted in the non-increasing order of their frequency.
Otherwise, the encoder still produces correct results, but at the expense of performance overhead.public LinearDictionaryEncoder(D dictionary, boolean encodeNull)
dictionary
- the dictionary. Its entries should be sorted in the non-increasing order of their frequency.
Otherwise, the encoder still produces correct results, but at the expense of performance overhead.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.