Class StructSubfieldEncoder
java.lang.Object
org.apache.arrow.vector.dictionary.StructSubfieldEncoder
Sub fields encoder/decoder for Dictionary encoded
StructVector
. Notes that child vectors
within struct vector can either be dictionary encodable or not.-
Constructor Summary
ConstructorDescriptionStructSubfieldEncoder
(BufferAllocator allocator, DictionaryProvider.MapDictionaryProvider provider) Construct an instance.StructSubfieldEncoder
(BufferAllocator allocator, DictionaryProvider.MapDictionaryProvider provider, ArrowBufHasher hasher) Construct an instance. -
Method Summary
Modifier and TypeMethodDescriptiondecode
(StructVector vector) Decodes a dictionary subfields encoded vector using the provided dictionary.static StructVector
decode
(StructVector vector, DictionaryProvider.MapDictionaryProvider provider, BufferAllocator allocator) Decodes a dictionary subfields encoded vector using the provided dictionary.encode
(StructVector vector, Map<Integer, Long> columnToDictionaryId) Dictionary encodes subfields for complex vector with a provided dictionary.
-
Constructor Details
-
StructSubfieldEncoder
public StructSubfieldEncoder(BufferAllocator allocator, DictionaryProvider.MapDictionaryProvider provider) Construct an instance. -
StructSubfieldEncoder
public StructSubfieldEncoder(BufferAllocator allocator, DictionaryProvider.MapDictionaryProvider provider, ArrowBufHasher hasher) Construct an instance.
-
-
Method Details
-
encode
Dictionary encodes subfields for complex vector with a provided dictionary. The dictionary must contain all values in the sub fields vector.- Parameters:
vector
- vector to encodecolumnToDictionaryId
- the mappings between child vector index and dictionary id. A null dictionary id indicates the child vector is not encodable.- Returns:
- dictionary encoded vector
-
decode
Decodes a dictionary subfields encoded vector using the provided dictionary.decode(StructVector, DictionaryProvider.MapDictionaryProvider, BufferAllocator)
should be used instead if only decoding is required as it can avoid building theDictionaryHashTable
which only makes sense when encoding.- Parameters:
vector
- dictionary encoded vector, its child vector must be int type- Returns:
- vector with values restored from dictionary
-
decode
public static StructVector decode(StructVector vector, DictionaryProvider.MapDictionaryProvider provider, BufferAllocator allocator) Decodes a dictionary subfields encoded vector using the provided dictionary.- Parameters:
vector
- dictionary encoded vector, its data vector must be int typeprovider
- dictionary provider used to decode the valuesallocator
- allocator the decoded values use- Returns:
- vector with values restored from dictionary
-