This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
Added support to round-trip dictionary arrays on parquet #232
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #211. Dictionary-encoding is a popular and important technique to reduce memory usage.
Parquet has an encoding specifically for this (PlainDictionary and RleDictionary). Arrow has "DictionaryArray" specifically for this. This PR bridges these two by allowing arrow2 to read and write dictionary arrays to and from parquet.
The semantics is as follows:
When writing to parquet, it is now possible to use
Encoding::PlainDictionary
andEncoding::RleDictionary
when writingDataType::Dictionary
fields. This causes the array to be dictionary-encoded into parquet (two pages: one with values one with indices).When reading from parquet, if the arrow schema on the metadata contains a field with
DataType::Dictionary
and the pages are dictionary-encoded, we read them to aDictionaryArray
(all other cases error with not yet implemented).As before, dictionary-encoded pages without an explicit
DataType::Dictionary
in the schema are read to their "natural", non-dictionary,DataType
.